mukada
mukada

Reputation: 1

help with rewriterule

Why wont http://mysite.com/threads/add go to post.php? instead it only show main.php no matter what i write after threads/

 RewriteRule threads/? /forum/main.php
 RewriteRule threads/add$ /forum/post.php

Upvotes: 0

Views: 100

Answers (1)

coreyward
coreyward

Reputation: 80041

When a request to anything with "/threads" comes in, it's being Rewritten to "/forum/main.php". Since "/forum/main.php" doesn't match your second RewriteRule it gets skipped.

To do what you're expecting, you should A) order your RewriteRules in order of precedence, and B) anchor your matches, like so:

RewriteRule ^/threads/?$ /forum/main.php
RewriteRule ^/threads/add$ /forum/post.php

And honestly, those could be cleaned up and made more flexible too.

Upvotes: 1

Related Questions