Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
mod_rewrite revisited
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- mod_rewrite revisited
mod_rewrite revisited
07-10-2010 11:33 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I have a domain hosted by PlusNet and pointing at the ccgi server, and I want to use mod_rewrite directives in .htaccess to point at a domain-specific subdirectory.
Thanks to previous assistance in here I had this working with the following:
However, it seems not to be working now and is raiseing:
[tt]Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.[/tt]
It's a while since I looked at it, so I'm wondering if it's perhaps a difference in the new ccgi platform?
I've installed WAMP on my own machine to try to track the problem down, but it seems to work as expected there. Any suggestions on how to fix it, or tips on how to debug such problems?
Thanks to previous assistance in here I had this working with the following:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^.*/[^/]+\.[^/]+$
RewriteRule ^(.+[^/])$ $1/ [R,L]
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.co\.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/folder/
RewriteRule (.*) /folder/$1
However, it seems not to be working now and is raiseing:
[tt]Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.[/tt]
It's a while since I looked at it, so I'm wondering if it's perhaps a difference in the new ccgi platform?
I've installed WAMP on my own machine to try to track the problem down, but it seems to work as expected there. Any suggestions on how to fix it, or tips on how to debug such problems?
Message 1 of 6
(1,034 Views)
5 REPLIES 5
Re: mod_rewrite revisited
07-10-2010 2:00 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
The last 3 lines are probably looping on new ccgi.
I think the line
needs to be
See here.
I think the line
RewriteCond %{REQUEST_URI} !^/folder/
needs to be
RewriteCond %{REQUEST_URI} !^/~username/folder/
See here.
David
Message 2 of 6
(289 Views)
Re: mod_rewrite revisited
08-10-2010 6:09 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Excellent - thanks very much, that seems to have fixed it. In doing that I screwed something else up somewhere such that, in a subdirectory below /folder, referenced files don't seem to be properly rewritten so .css isn't working etc. I'll have a trawl, but if this is a common 'gotcha' with a simple solution, a pointer in the right direction would be most appreciated 
Thanks again.

Thanks again.
Message 3 of 6
(289 Views)
Re: mod_rewrite revisited
09-10-2010 12:53 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I suspect the presence of /~username might be upsetting things here too. Is it PHP code that is generating the subdirectory references?
David
Message 4 of 6
(289 Views)
Re: mod_rewrite revisited
09-10-2010 10:59 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
No, the pages I've looked at so far have just been plain HTML files with simple references, e.g.:
... etc.
link href="styles.css"
form action="search.php"
... etc.
Message 5 of 6
(289 Views)
Re: mod_rewrite revisited
09-10-2010 1:20 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Hmmm... I've got it working now. The problem turns out to have been with another .htaccess file I have in the subdirectory so was nothing to do with the ~username change. I was rewriting a filename for backward-compatibility, but I seem to need to redirect in order to get the css files etc. to work:
Out of interest, can anyone explain to me why it has to be a Redirect in order to work? It's not really important in this case, but it could be in other cases where I might not want to have the actual URL appear in the browser's address bar.
RewriteCond %{REQUEST_URI} oldname/$ [nc]
# RewriteRule .* newname.htm// Works, but unqualified links to other files in same directory fail
RewriteRule .* newname.htm [R,L] // Works, and links are honoured
Out of interest, can anyone explain to me why it has to be a Redirect in order to work? It's not really important in this case, but it could be in other cases where I might not want to have the actual URL appear in the browser's address bar.
Message 6 of 6
(289 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page