Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php .htaccess mod用变量重写_Php_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Php .htaccess mod用变量重写

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

我试图做一个简单的重定向我的网站,但我没有运气让它工作

我的.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]
    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]