开发者

.htaccess mask - SEO

Looking to put the following into my htaccess file:

 User visits http://mysite.com/test/test/123
 User is actually visiting http://mysite.com/test/index.php?q=123

I have seen it done before but I can't figure it out. The user is not supposed to see that they are visiting the second url. T开发者_StackOverflow中文版his is particularly useful for SEO. Can anyone help me on this one?

Updated Code for Answer:

Options -Multiviews
rewriterule ^test\/([a-zA-Z]+)\/([0-9]+)$ test\/index\.php?id=$3  [L]

*Note: The Options -Multiviews is needed for GoDaddy hosting to enable mod_rewrite.*


Be sure mod_rewrite is on:

RewriteEngine on
RewriteRule ^test/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ test.php?id=$2


Double test

RewriteEngine On
RewriteRule ^test/test/([^/]*)$ /test/index.php?q=$1 [L]

Single test

RewriteEngine On
RewriteRule ^test/([^/]*)$ /test/index.php?q=$1 [L]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜