[英]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.