.htaccess RewriteRule


We just moved a site over from one Dreamhost account to another. The files should be exactly the same but the RewriteRule in the main.htaccess file is not doing its job on the new account. The site was built to redirect search engine friendly path names to a php page.

Here is the htaccess file just in case you need to see what we are trying to do.

AddType application/x-httpd-php .php .html
RewriteEngine on
Options +FollowSymlinks

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.+) - [PT,L]

RewriteRule ^builders/(.+)$ secondary_flash.html [QSA,L]
RewriteRule ^pillar/(.+)$ secondary_flash.html [QSA,L]
RewriteRule ^articles/(.+)$ article.html [QSA,L]
RewriteRule ^articles/ news.html [QSA,L]
RewriteRule ^admin/(.+)$ admin/secondary.php [QSA,L]
RewriteRule ^(.+)$ secondary.php [QSA,L]

Any help would be greatly appreciated.



What is the behavior?

Does it reroute you to the page with an html extension, but it doesn’t get processed by php?

Does it actually just route to the original page without any rewrite happening?

Are you on a shared environment?

Are you running a custom php install or the default one?

Can you share an example “working” url with us?



Ex. 404 Not Found


The pages I am testing should go to secondary.php but in the form I noticed the html too and am baffled by it because those pages have php code that needs to execute to work correctly.


The redirect should send a url to secondary.php without changing the url to secondary.php. So runs secondary.php >> ($url =$_SERVER[‘REQUEST_URI’]:wink: and turns into $url = “/some_page/”;


Yes. Standard Dreamhost account.




Here is the working example… http://www.livecascadia.com/The_Cascadia_Community/

Again thanks for the help…


I am trying to come up with a coherent response to this but I am having trouble because I am far from an expert on the subject. I didn’t want to just fade away, but I’ll post back when I can come up with something useful.


Here’s something. Every .htaccess file that uses mod_rewrite directives need to use the RewriteBase directive as well.

:cool: openvein.org -//-