繁体   English   中英

URL重写和重定向问题

[英]URL Rewriting and redirection issue

RewriteCond %{HTTP_HOST} ^seedscrew\.org\.crew$ [OR]
RewriteCond %{HTTP_HOST} ^www\.seedscrew\.org\.crew$
RewriteRule ^crew/([A-Za-z0-9-]+)/ "http\:\/\/www\.seedscrew\.org\crew\/index\.php\?mode=login&act=home" [R=301,L]

我已经用.htacess文件编写了。 我想从hostpath / index.php?mode = login&act = home重定向到hostpath / username

您只需要以下规则DOCUMENT_ROOT/.htaccess文件:

RewriteEngine On

RewriteRule ^crew/([A-Za-z0-9-]+)/?$ /crew/?mode=login&act=home [QSA,L]

否则,此规则在DOCUMENT_ROOT/crew/.htaccess文件中:

RewriteEngine On
RewriteBase /crew/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9-]+)/?$ ?mode=login&act=home [QSA,L]
RewriteRule ^crew/([A-Za-z0-9-]+)/?$ http://www.seedscrew.org/crew/index.php?mode=login&act=home [R=301,L] [R=301,L]

记住[R = 301,L]表示您正在将请求重定向到指定的url。 如果在相同的上下文中,则使用如下。 [机组人员是这里的上下文]。

RewriteRule ^crew/([A-Za-z0-9-]+)/?$ /crew/index.php?mode=login&act=home [L,PT]

暂无
暂无

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

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