views:

75

answers:

1

In my .htaccess file I have the following rule defined.

RewriteRule t/([^.]+)/$ /video/tag.php?tag=$1 [QSA]

This rule is working fine for tag pages. When I am accessing URL as http://example.com/video/t/funny/ then its displaying all the result with tag funny.

But When I am accessing a URL http://example.com/video/script/common/video.php Then its displaying the TAG page with search tag results for tag common. I think there is some confliction between the URL and .htaccess rule.

Its taking /t/common/ and applying htaccess rule on this. How to solve this issue??

+2  A: 

Your rewrite rule is matching the string in question. You want to change it to be like this:

RewriteRule ^/video/t/([^.]+)/$ /video/tag.php?tag=$1 [QSA]

Basically, what is happening is that since you didn't specify the START of your rule, it was matching the end of "script" in your url and taking it away from there.

If you want a less specific string, try this one:

RewriteRule /t/([^.]+)/$ /video/tag.php?tag=$1 [QSA]
Paul McMillan
When I am adding `RewriteRule ^/video/t/([^.]+)/$ /video/tag.php?tag=$1 [QSA]` rul in my .htaccess file of folder `video` then it gives me 404 page not found error?
Prashant
Try the other rule then. The first rule I put would work best in your domain's root.
Paul McMillan
Yes, first one works best in the root of ma application. But to work the rule in my video folder's htaccess I have added `RewriteRule ^t/([^.]+)/$ /video/tag.php?tag=$1 [QSA]` and it works for me. Thanks
Prashant