.htaccess RewriteRule

.htaccess RewriteRule

Posted by: xtion111177
Posted on: 2009-03-12 10:36:00

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.

Thanks!

Re: .htaccess RewriteRule

Posted by: pangea33
Posted on: 2009-03-12 17:32:00

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?

Re: .htaccess RewriteRule

Posted by: xtion111177
Posted on: 2009-03-12 18:09:00

>>What is the behavior?
Ex. http://208.113.233.30/articles/23/ 404 Not Found

>>Does it reroute you to the page with an html extension, but it doesn't get processed by php?
The pages I am testing should go to secondary.php but in the form http://208.113.233.30/some_page/. I noticed the html too and am baffled by it because those pages have php code that needs to execute to work correctly.

>>Does it actually just route to the original page without any rewrite happening?
The redirect should send a url to secondary.php without changing the url to secondary.php. So http://208.113.233.30/some_page/ runs secondary.php >> ($url =$_SERVER['REQUEST_URI'];) and turns into $url = "/some_page/";

>>Are you on a shared environment?
Yes. Standard Dreamhost account.

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

>>Can you share an example "working" url with us?
Here is the working example... http://www.livecascadia.com/The_Cascadia_Community/

Again thanks for the help...


Re: .htaccess RewriteRule

Posted by: pangea33
Posted on: 2009-03-12 21:28:00

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.

Re: .htaccess RewriteRule

Posted by: Atropos7
Posted on: 2009-03-12 22:39:00

In reply to:

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 -//-

Tags: qsadreamhosthtaccess filehttpdsearch enginejob