[英]Want to stop subdirectory from showing in urls
我已经阅读了很多有关此主题的主题,但是我对这方面的知识不是很精通,对我来说没有任何帮助。
我将Wordpress安装在一个子目录中,并且:
.htaccess
和index.php
复制到根目录。 index.php
文件,以便require('wp / wp-blog-header.php')指向子目录。 一切正常,除了子目录显示在URL中,我想隐藏它。
我安装到的子目录是“ NA20H”。 将index.php
文件更改为指向它之后,这就是我所拥有的。
根目录中的.htaccess
文件显示为:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /NA20H/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /NA20H/index.php [L]
</IfModule>
子目录中的.htaccess
读取为:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /NA20H/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /NA20H/index.php [L]
</IfModule>
为了使“ NA20H”停止在URL中显示,我需要怎么做? 谢谢。
无需将index.php复制到root。 只需按照以下步骤。 将其放在根目录的.htaccess中。
RewriteEngine On
RewriteBase /
RewriteRule ^$ NA20H/ [L]
RewriteRule ^(.*)$ NA20H/$1 [L]
将其放在NA20H文件夹中的.htaccess中
RewriteEngine On
RewriteBase /NA20H/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.