![](/img/trans.png)
[英]Rewrite url not working with hyphen “-” using .htaccess with php
[英]Rewrite url using .htaccess in php not working
我想改写下面的网址
http://www.example.com/page.php?n=关于%2BUs&id = F534Z531G538
至
http://www.example.com/about-us
使用.htaccess文件。 我已经尝试过我的.htaccess中的以下代码
Options +FollowSymlinks
RewriteEngine on
rewriterule ^page.php?n=About%2BUs&id=F534Z531G538(.*)$ http://www.example.com/about-us$1 [r=301,nc]
但这不起作用,并且id是随机生成的。
有人可以帮助我吗?
尝试这个
RewriteRule ^about-us/([a-zA-Z0-9]+)$ page.php?id=$1
对于http://www.example.com/about-us/f14dfa
对于http://www.example.com/about-us
RewriteRule ^about-us$ page.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.