开发者

the .htaccess is not working

I'm trying to write a simple .htaccess rule to change

https://webxxx.example.net/~test/id/123

to

https://webxxx.example.net/~test/show.php?id=123

But

https://webxxx.example.net/~test/id/123

is now redirected to my 404 page not found.

my .htaccess:

RewriteEngine on
RewriteRule ^\/?~test\/id\/(\w+)$ /~test/show.php?hash=$1 

Why 开发者_Go百科doesn't this work?


The solution:

don't need match the reference of public_html folder in regular expression, only in replace

RewriteEngine onRewriteRule ^id\/(\w+)$ /~test/show.php?hash=$1 

thanks to all :)


where is the .htaccess placed ? is it under the main root ? or is it under the subfolder (subdomain) ... try to change the place of the .htaccess and make sure it is under the specific subdomain area .


I think this is what you want:

RewriteEngine on    
RewriteRule ^id\/([0-9]*)$ /~test/show.php?id=$1

This will just accept numbers after the id.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜