繁体   English   中英

如何重定向到htaccess中的特定URL

[英]How to redirect to a specific url in htaccess

我不明白如何从这个问题中创建问题标题。

好的,

我正在使用.htaccess并试图重写url

通过此RewriteRule ^fc.com/([a-zA-Z0-9]+) index.php?s=$1 ,到目前为止, fc.com/abc123可以工作。

我试图通过<a href="index.php?s=abc123">Test</a>对其进行<a href="index.php?s=abc123">Test</a>

它不起作用(按计划),但是如果对index.php?s=abc123发出请求,如何重定向到fc.com/abc123

采用:

# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} \s/+index\.php\?s=([^\s&]+) [NC]
RewriteRule ^ /fc.com/%1? [R=301,L,NE]

# internal forward from pretty URL to actual one
RewriteRule ^fc.com/([a-zA-Z0-9]+) index.php?s=$1 [L,QSA,NC]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM