2016-01-01 69 views
0

我從apache 2.2移動到2.4,但在.htaccess中的代碼RewriteRule ^(pl)($|/) - [L]現在不工作。我嘗試了幾乎所有的東西,但是我仍然無法完成它的工作。

有人可以幫忙嗎?請

+1

首先確保的.htaccess (Accessfile)已啓用,默認情況下已禁用。檢查這個鏈接http://webmasters.stackexchange.com/questions/61009/how-to-enable-use-of-htaccess-in-apache-on-ubuntu – Oxi

+1

你也應該解釋一下這條線的意思。 。你的意思是「不工作」。例如: – arkascha

+0

:我有這個網址mydomain.com/pl/some-article/,現在它使用根.htaccess規則,我需要它只使用來自dir mydomain.com/pl/的.htaccess規則。部分「some-article /」只是虛擬的......在「pl」目錄中是另一個WP安裝 – user3540265

回答

0

htaccess的根:在PL DIR

RewriteEngine On 
RewriteRule ^(pl)($|/) - [L] 
RewriteCond %{HTTP_HOST} ^([a-z.]+)?myweb\.com$ [NC] 
RewriteCond %{HTTP_HOST} !^www\. [NC] 
RewriteRule .? http://www.myweb.com%{REQUEST_URI} [R=301,L] 
RewriteCond %{SCRIPT_FILENAME} !-d 
RewriteRule ^([^\.]+)$ $1.php [NC,L] 

的htaccess:

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule>  
+0

這應該被添加問題而不是答案。 – anubhava

0

/pl/目錄應該是htaccess的:

RewriteEngine On 
RewriteBase /pl/ 

RewriteRule ^index\.php$ - [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . index.php [L] 
+1

非常感謝,它工作正常。我認爲這個問題可能只在根目錄。 – user3540265

+0

很高興知道它已經解決了,[您可以點擊答案左上角的勾號**標記答案](http://meta.stackexchange.com/a/5235/160242) – anubhava