Forum Moderators: phranque
RewriteCond %{HTTP_HOST} ^www.mydomain.com$ [NC]
RewriteRule ^(.*)$ /bla.php [L]
When I leave out the (.*) the line works fine but obviously only handles the home page. Putting in the (.*) produces an Internal Server Error. Anyone know why?
I spent several hours googling for a solution, to no avail. According to some sites, this line should work as-is. Others say to leave out the brackets, and/or the ^ and $, but all of that doesn't solve the problem.
If I preceed or follow the (.*) with a string, there's no problem. I have other lines in my htaccess that use only wildcards in the pattern, such as
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
and that works perfectly fine. However, that's a *redirect*, and in this case I don't want a redirect. I just want all paths and files under this domain to be *transformed* to a single script, like I do with all the other RewriteRules in my htaccess that *do* work.
I couldn't find the answer to this problem already in the forum; if it is there, please let me know?
[edited by: jdMorgan at 2:10 pm (utc) on Aug. 31, 2007]
[edit reason] example.com [/edit]
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteCond %{THE_REQUEST} !^/blah\.php$
RewriteRule .* /bla\.php [L]
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule !^blah\.php$ /bla\.php [L]
Jim