我在root中安装了Wordpress的集成有问题,并且在名为“client”的子文件夹中安装了Whmcs。 并且都有自己的.htaccess文件:
Wordpress(root):
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
SetEnv TZ Europe/Rome
Whmcs(/ client):
RewriteEngine On
# Announcements
RewriteRule ^announcements/([0-9]+)/[a-z0-9_-]+\.html$ ./announcements.php?id=$1 [L,NC]
RewriteRule ^announcements$ ./announcements.php [L,NC]
# Downloads
RewriteRule ^downloads/([0-9]+)/([^/]*)$ ./downloads.php?action=displaycat&catid=$1 [L,NC]
RewriteRule ^downloads$ ./downloads.php [L,NC]
# Knowledgebase
RewriteRule ^knowledgebase/([0-9]+)/[a-z0-9_-]+\.html$ ./knowledgebase.php?action=displayarticle&id=$1 [L,NC]
RewriteRule ^knowledgebase/([0-9]+)/([^/]*)$ ./knowledgebase.php?action=displaycat&catid=$1 [L,NC]
RewriteRule ^knowledgebase$ ./knowledgebase.php [L,NC]
并且有一个设置在Whmcs中激活url友好,但是当我激活它时,它给我的文件没有找到它就像根的.htaccess的ineherite,事实上,当我冲洗wordpress的htaccess(安装在root中)时url友好的工作在子文件夹中。
我尝试在其他帖子中找到的许多代码从根目录中排除子文件夹,但它不起作用,我认为这是同一个问题的人 how to ignore the .htaccess file from a parent directory 但直到现在他也找不到解决方案。
非常感谢您的帮助!
答案 0 :(得分:0)
描述在WordPress正文中重写的所有网址
RewriteEngine On
RewriteCond %{HTTP_HOST} !^example\.com
RewriteRule (.*) http:// www.example.com/$1 [R=301,L]
RewriteRule ^([^/\.]+)/$ http:// %{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^([^/\.]+)$ index.php?rewrite=$1 [L]
或
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ index\.php\ HTTP
RewriteRule ^index\.php$ http:// www.example.com/ [R=301,L]
用于重写www和删除index.php的URL的两个示例