从我的网站URL';s正在使用htaccess,现在wordpress没有了';不起作用


removing .php from my site URL's using htaccess, now wordpress doesn't work

我的网站一直在使用以下代码从URL的末尾删除.PHP

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php

我现在已经在/clients/文件夹中安装了WordPress,但它不起作用,因为它也在重写WordPress,我不希望它这样做,但我不知道如何修复上面的代码以阻止它在sup文件夹中发生。

感谢

完整.htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

压缩文本,html,javascript,css,xml:

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

或者,按扩展名压缩某些文件类型:

SetOutputFilter DEFLATE

在/clients/文件夹中添加一个.htaccess文件,其中包含以下内容:-

RewriteEngine off

这将关闭该文件夹及其子文件夹的mod_rewrite。

Voila