Forum Moderators: phranque
Regards,
Luke
[edited by: luke64 at 9:29 pm (utc) on May 30, 2008]
The rule you show is commented-out, and so will not be executed.
It also contains no provision to avoid rewriting requests for /ppg/foo to /ppg/ppg/foo/ to /ppg/ppg/ppg/foo, etc. and so it will loop until the server reaches its "internal redirection limit" and gives up.
Jim
RewriteCond %{HTTP_HOST} ^localhost$ [OR]
RewriteCond %{HTTP_HOST} ^www\.localhost$
RewriteCond %{REQUEST_URI} !^/localhost/
RewriteRule \/(.+)$ mysite/$1
I don't think I'm approaching capturing the existing url correctly for me to then insert the sub directory into the url?
Mod_rewrite is details -- all details, and lots of details. So discussion, questions and instructions in this forum must be written and read very carefully. Attention to detail determines success or failure.
Jim
You'll notice I've changed the rewrite rule I'm using again - just testing different examples I'm finding...
Code:
# Enable mod_rewrite
RewriteEngine on
RewriteBase /
#RewriteCond %{HTTP_HOST} localhost
RewriteCond %{REQUEST_URI} !mysite/
RewriteRule ^(.*)$ /mysite/$1 [R=301,L]
---------------------------------
Relevant settings from httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
<Directory "C:/xampp/htdocs/mysite/">
AllowOverride All
</Directory>
Luke
Also the rewrite condition #RewriteCond %{HTTP_HOST} localhost is not commented out as my earlier message described.
Try this:
RewriteEngine on
RewriteRule ^foo\.html$ http://www.google.com/ [R=301,L]
If not, add a line:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^foo\.html$ http://www.google.com/ [R=301,L]
Jim