我想重定向网址:
http://www.mysite.com/invite/YhMck/en
到
http://www.mysite.com/auth/accept_invite/YhMck/en
可以帮我解决RewiteRule
答案 0 :(得分:1)
RewriteCond%{HTTP_HOST} ^ mysite.com / invite / YhMck / en RewriteRule(。*)http://www.mysite.com/auth/accept_invite/YhMck/en/ $ 1 [R = 301,L] RewriteEngine On
答案 1 :(得分:0)
将此内容添加到.htaccess
documentroot
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} ^/invite
RewriteRule ^invite/([^/]+)/(\w{2})$ auth/accept_invite/$1/$2
来自评论: 这些规则:
RewriteCond $1 !^(index\.php|robots\.txt|images|img|css|js|fonts)
RewriteRule ^(.*)$ /index.php/$1 [L]
将index.php添加到不以index.php|robots\.txt|images|img|css|js|fonts
因此,您的/invite
也会被重新写入/index.php/invite...
以相同的顺序尝试此操作
RewriteEngine on
RewriteBase /
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^ - [L]
RewriteCond %{REQUEST_URI} ^/invite
RewriteRule ^invite/([^/]+)/(\w{2})$ auth/accept_invite/$1/$2 [L]
RewriteCond $1 !^(auth/|index\.php|robots\.txt|images|img|css|js|fonts)
RewriteRule ^(.*)$ /index.php/$1 [L]