Forum Moderators: phranque
RewriteEngine On
RewriteCond %{HTTP_HOST} second-domain.com$ [NC]
RewriteCond %{REQUEST_URI}!^/second-domain/.*$
RewriteRule (.*) /second-domain/$1
When I go to www.second-domain.com it pulls up the page correctly (index.php), but if I go to www.second-domain.com/index.php it does not. I tested the redirect with other files in the second-domain directory and it works fine. Only index.php fails.
Any thoughts? Thanx.
RewriteEngine On
RewriteCond %{HTTP_HOST} second-domain\.com [NC]
RewriteCond %{REQUEST_URI} !^/second-domain/
RewriteRule (.*) /second-domain/$1 [L]
Also, being very specific, if *only* your index.php file is failing with mod_rewrite, and you *do* have other php files in the same directory that work, then you've got some very specific problem and it should be easy to find. At the other end of the scale, if *all* of your php files fail, and you're running on Apache 1.x, then it's likely that you have an error in your LoadModule list order in httpd.conf, and php is running before mod_rewrite is invoked. If this is the case, then PHP must be loaded *before* mod_rewrite in order to execute *after* mod_rewrite. The execution priority is the reverse of the loadmodule order on Apache 1.x
Jim
I uploaded phpinfo.php and sure enough it looks like there is a problem with the loadModules order. Unfortunately this domain is hosted on servers other than my own so I don't have control of the httpd.conf.
I'll contact them and see if they can resolve the problem. Let's hope so! Thanks for the suggestions for the improvements to my .htaccess file as well.
Thanks for the great help,
Robert