2016-01-01 83 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