簡體   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