Php .htaccess mod用变量重写
我试图做一个简单的重定向我的网站,但我没有运气让它工作 我的.htaccess是:Php .htaccess mod用变量重写,php,apache,.htaccess,mod-rewrite,Php,Apache,.htaccess,Mod Rewrite,我试图做一个简单的重定向我的网站,但我没有运气让它工作 我的.htaccess是: Options +FollowSymLinks IndexIgnore */* RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(es|fr|pt|de|zh|ru|my|in|ae|bd)\.my-site\.com$ RewriteRule (.*) - [QSA,E=LANGUAGE:%1] RewriteC
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(es|fr|pt|de|zh|ru|my|in|ae|bd)\.my-site\.com$
RewriteRule (.*) - [QSA,E=LANGUAGE:%1]
RewriteCond %{ENV:LANGUAGE} ^$
RewriteRule (.*) - [QSA,E=LANGUAGE:en]
RewriteRule (.*) $1?language=%{ENV:LANGUAGE} [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^profile/(.*)$ http://my-site/decorators/profile/$1
RewriteRule ^(.*)$ index.php
我希望它重定向到
http://my-site/decorators/profile/whatever 如果用户浏览到http://my-site/profile/whatever
添加以下htaccess代码
RewriteCond ^([profile]+)/(.*)$
RewriteRule ^([decorators]+)/([profile]+)/(.*)$
删除htaccess中的以下代码
RewriteRule ^profile/(.*)$ http://my-site/decorators/profile/$1
你的规则是这样的:
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
RewriteBase /
RewriteRule ^(profile/.*)$ /my-site/decorators/$1 [NC,L,R=302]
RewriteCond %{HTTP_HOST} ^(es|fr|pt|de|zh|ru|my|in|ae|bd)\.my-site\.com$
RewriteRule (.*) - [QSA,E=LANGUAGE:%1]
RewriteCond %{ENV:LANGUAGE} ^$
RewriteRule (.*) - [QSA,E=LANGUAGE:en]
RewriteRule (.*) $1?language=%{ENV:LANGUAGE} [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]