开发者

mod rewrite problem?

I am facing a problem using mod_rewrite. This is what I am using

Options +FollowSymLinks
RewriteEngine on
RewriteRule pc/$ /pc.php

to rewrite http://www.example.com/pc/ to http://www.example.com/pc.php.开发者_开发问答

This is working perfectly fine but, when I go to a domain such as http://www.example.com/news/today-in-pc/ it is showing the pc.php page.

What am I doing wrong here and how can I eliminate this problem? Thanks


You need to anchor the match to the start of the URL:

# If you're using .htaccess
RewriteRule ^pc/$ /pc.php

# If you're using httpd.conf
RewriteRule ^/pc/$ /pc.php
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜