Forum Moderators: phranque

Message Too Old, No Replies

htaccess Mod Rewrite not working on a new server

         

jronzio

3:20 am on Mar 17, 2006 (gmt 0)

10+ Year Member



I am using a .htaccess file I recieved from another webhost and just trying to port it to a new server. For some reason it is not working on the new server.

RewriteEngine on
RewriteBase /
RewriteRule ^docs/(\w+)$ docs/$1/ [R]
RewriteRule ^docs/ac(\d+)/$ m/content/article.php?content_id=$1
RewriteRule ^docs/pc(\d+)/$ product.php?category_id=$1
RewriteRule ^docs/pr(\d+)/$ details.php?product_id=$1
RewriteRule ^docs/ca(\d+)/$ listings.php?category_id=$1
RewriteRule ^docs/fl(\d+).(\w+)$ getfile.php?name=content_$1&type=$2
RewriteRule ^docs/ga(\d+)/$ m/photos/details.php?photo_gallery_id=$1
RewriteRule ^docs/gl(\d+)/$ m/photos/image.php?photo_id=$1
RewriteRule ^docs/gi(\d+).(\w+)$ m/photos/getfile.php?name=gallery_image_$1&type=$2
RewriteRule ^docs/ts(\d+).(\w+)$ [google.ca...]

any help is appreciated.
Thanks.

jdMorgan

7:36 pm on Mar 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try adding:

Options +FollowSymLinks

at the top of your code. This option must be enabled, either in the server configuration or in your .htaccess file, in order to enable mod_rewrite.

The first RewruteRule looks suspicious, and may cause an 'infinite loop'. Try commenting it out and test again.

Jim

jronzio

1:20 am on Mar 18, 2006 (gmt 0)

10+ Year Member



I tried the line you suggested and it was one I stumbled into during my research last night. I also commented out the line you mentioned could cause an infinate loop with no result.

There is in fact no "docs" folder, it is an Apache alias which is better for search engines. They are called using an alias in the ".htaccess" file this allows for document security on an Apache platform. So what actually happens is this:

You type:
http://example.com/docs/ac1/

And you get: http://example.com/m/content/article.php?content_id=1

You type:
http://example.com/docs/gi1.jpg

And you get: http://example.com/getfile.php?name=content_1&type=jpg

That was the email from the developer of the site originally maybe it has some info that would allow you to help me out.

Thanks,
Joe

[edited by: jdMorgan at 1:26 am (utc) on Mar. 18, 2006]
[edit reason] Example.com [/edit]

jdMorgan

1:29 am on Mar 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If none of those rules work, even with the Options directive added, then you should ask you hosting provider about it. It sounds like mod_rewrite is not loaded, not enabled, or not allowed in an .htaccess context on your server.

Jim