![](/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.