2014-12-22 25 views
1

我需要轉發/重定向從的.htaccess轉發URL從一個到另一個

http://local.abcxyz.com/be/country/CN/BE 

http://local.abcxyz.com/be/country/visum-china/BE 

我可怎麼辦使用的.htaccess其域名嗎?

我目前的htaccess文件看起來像這樣

RewriteEngine On 

    # If the file or directory exists, show it 
    RewriteCond %{REQUEST_FILENAME} -f [OR] 
    RewriteCond %{REQUEST_FILENAME} -d 
    RewriteRule ^(.+) - [PT,L] 
    # Blank queries get sent to the index 
    #RewriteRule ^$ index.php [L] 
    # All other queries get sent to the index as index.php/whatever 
    #RewriteRule ^(.*)$ index.php/$1 [L] 

    RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt) 
    RewriteRule ^(.*)$ /be/index.php/$1 [L] 

這htaccess的中文件夾中。

回答

3

您可以在DOCUMENT_ROOT/be/.htaccess文件中使用此代碼:

RewriteEngine On 
RewriteBase /be/ 

RewriteRule ^country/CN/BE/?$ country/visum-china/BE [L,NC] 

# If the file or directory exists, show it 
RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule^- [L] 

RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt) 
RewriteRule ^(.+)$ index.php/$1 [L] 

假設有在/country/沒有的.htaccess或以下的任何目錄。

+0

你的解決方案沒有工作。 – Asif

+0

該評論不會幫助任何人。 Q0。你在瀏覽器中輸入了什麼網址? Q1。這是唯一的.htaccess還是你有另一個? Q2。這是這個.htaccess中唯一的代碼嗎?如果您有其他代碼,請將其張貼在問題中? Q3。以上.htaccess的位置是什麼? Q4。你確定'mod_rewrite'和'.htaccess'是否被啓用? – anubhava

+0

我在我的問題中添加了所有必需的信息。現有的htaccess,它的位置也是如此。 – Asif

相關問題