.htaccess apache 2.4 - RewriteRule ^(pl)($ | /) - [L]

时间:2016-01-01 15:36:04

标签: apache .htaccess

我从apache 2.2迁移到2.4但是.htaccess中的代码RewriteRule ^(pl)($|/) - [L]现在无效。我几乎尝试了一切,但我仍然无法使它发挥作用。

有人可以帮忙吗?请

2 个答案:

答案 0 :(得分:0)

root中的htaccess:

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]
PL目录中的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>    

答案 1 :(得分:0)

这应该是/pl/目录中的htaccess:

RewriteEngine On
RewriteBase /pl/

RewriteRule ^index\.php$ - [L]

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