最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

url rewriting - Help with .htaccess setup to hide WordPress Directory

programmeradmin1浏览0评论

I have a WordPress site that is installed in a directory called cms.

I will be using a pure HTML page as my Home page, the inner pages will be using WordPress.

Let's call the website mysite

visiting mysite needs to show my plain html page.

The help I need is to hide the cms folder in the URL.

I have the following .htaccess file in my root

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?mysite$
RewriteCond %{REQUEST_URI} !^/cms/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /cms/$1 
</IfModule>

And this .htaccess in side the cms directory:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cms/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /cms/index.php [L]
</IfModule>

I don't think I need to have both but that is the only way I've gotten the pages to show up without an error.

For example lets say I have a page called MyPage

With how I have things set now it is accessible at:

mysite/MyPage AND mysite/cms/MyPage

I need it to only be accessible at mysite/MyPage

While maintaining the ability to serve the static HTML page at mysite

Any advice is appreciated!

发布评论

评论列表(0)

  1. 暂无评论