[英]Want to stop subdirectory from showing in urls
I've read a lot of threads on this topic, but I'm not very proficient at this stuff and nothing has worked for me. 我已经阅读了很多有关此主题的主题,但是我对这方面的知识不是很精通,对我来说没有任何帮助。
I installed Wordpress in a sub directory and: 我将Wordpress安装在一个子目录中,并且:
.htaccess
and index.php
to the root directory. .htaccess
和index.php
复制到根目录。 index.php
file so that the require('wp/wp-blog-header.php') pointed to the subdirectory. index.php
文件,以便require('wp / wp-blog-header.php')指向子目录。 Everything works, except the subdirectory shows in the URL, which I would like to hide. 一切正常,除了子目录显示在URL中,我想隐藏它。
The subdirectory I installed to is 'NA20H'. 我安装到的子目录是“ NA20H”。 After changing the
index.php
file to point to it, this is what I have. 将
index.php
文件更改为指向它之后,这就是我所拥有的。
The .htaccess
file in the Root directory reads: 根目录中的
.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>
And the .htaccess
in the subdirectory reads: 子目录中的
.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>
What do I need to do in order to get 'NA20H' to stop showing in the URLs? 为了使“ NA20H”停止在URL中显示,我需要怎么做? Thank you.
谢谢。
No need to copy index.php to root. 无需将index.php复制到root。 Just follow these steps.
只需按照以下步骤。 Put this in the .htaccess in the root.
将其放在根目录的.htaccess中。
RewriteEngine On
RewriteBase /
RewriteRule ^$ NA20H/ [L]
RewriteRule ^(.*)$ NA20H/$1 [L]
Put this in .htaccess in the NA20H folder 将其放在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.