Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My site uses mod_rewrite for most URL's within the site. eg.

domain.com/contact.htm

domain.com/product/details.htm

I've had domain.com/contact.htm working for a long time and is quite simple, but unfortunately I cannot for the life of me get subfolder rewrites working so that I can go to domain.com/product1/about.htm without it taking me straight to a 404 page. Here is an excerpt from my .htaccess.

RewriteRule ^product1/([^/]+).htm$ /product1/index.php?p=$1 [L] #Even hardcoded isn't working...
RewriteRule ^([^/]+)/([^/]+)/([^/]+).htm$ /$1/$2/index.php?p=$3 [L]
RewriteRule ^([^/]+)/([^/]+).htm$ /$1/index.php?p=$2 [L]
RewriteRule ^([^/]+).htm$ /index.php?p=$1 [L]

These rules work fine on http://martinmelin.se/rewrite-rule-tester/ but never seem to work in practice. I'd love some help on this.

Edit: FYI, this is a singular .htaccess file located in the root www folder of domain.com.

Thanks.

share|improve this question

migrated from stackoverflow.com Jun 24 '11 at 9:22

This question came from our site for professional and enthusiast programmers.

    
Are those all of your rules? You might have conflicting rules somewhere. –  Jacob Eggers Jun 23 '11 at 23:17
    
Yes, these are all of the rules I use. –  Craig White Jun 23 '11 at 23:18
    
Perhaps this question belongs on Webmasters? –  Cupcake Jun 23 '11 at 23:26

1 Answer 1

D'oh!.... Ok, apache obviously didn't like me having a .htaccess file within the subfolder with RewriteEngine On even though there weren't any rules. I removed the RewriteEngine On and it worked. Bam. 2 Evenings gone.

Thanks anyway guys.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.