通过隐藏子目录的.htaccess中显示的网址是什么? [英] Hide subdir in displayed URL via .htaccess?
问题描述
我的客户的域名指向/的public_html;他的网站是/的public_html / WP。 我有一个htaccess的重定向到/的public_html / WP:
My client's domain name points to /public_html; his website is at /public_html/wp. I have a .htaccess that redirects to /public_html/wp:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?somedmain\.com$
RewriteCond %{REQUEST_URI} !^/wp/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wp/$1 [L]
RewriteCond %{HTTP_HOST} ^(www\.)?somedmain\.com$
RewriteRule ^$ /wp/ [L]
然而,当用户导航到网页,链接显示为somedmain.com/wp/permalink。
However, when the user navigates to a page, the url is displayed as somedmain.com/wp/permalink.
我一直在试图找出如何隐藏在URL中的WP;这可能吗?
感谢您的任何提示......
I've been trying to figure how to hide the "wp" in the url; is that possible?
Thanks for any hints....
推荐答案
有没有需要重定向。它可以直接在Word preSS来实现。
There is no need for redirection. It can be achieved directly in Wordpress.
有一个WP与安装在一个目录下的核心文件,而是显示在浏览器的地址栏中另一个目录的方式,描述如下:
The way to have a WP install with the core files in one directory, but show another directory in the browser's address bar, is described below:
在常规设置的有2个网址,字符preSS地址(URL)和网站地址(URL):
- 的网站地址(URL)的设置为你希望人们在键入他们的浏览器,以达到您的Word preSS博客地址。
- 的字preSS地址(URL)的设置是在您的Word preSS核心文件所在的地址。
- The Site Address (URL) setting is the address you want people to type in their browser to reach your WordPress blog.
- The WordPress Address (URL) setting is the address where your WordPress core files reside.
整个过程将在本文档 Giving_Word press_Its_Own_Directory 。
在这个例子中,目前的WP安装是 http://example.com/wp
和地址输入并显示在浏览器的地址栏 http://example.com
。
For this example, the current WP install is at http://example.com/wp
and the address to enter and show in the browser's address bar is http://example.com
.
- 到设置 - >通用的。
- 在网站地址(URL)的,进入该目录显示:
http://example.com
在这种情况下。没有结尾的斜线。
- 保存更改并注销。
- 复制
的.htaccess
和的index.php
文件从的http://例子。 COM / WP
到http://example.com。
- 开启
的index.php
在http://example.com
并替换:
- Go to Settings -> General.
- In Site Address (URL), enter the directory to show:
http://example.com
in this case. NO trailing slash. - Save changes and log out.
- Copy
.htaccess
andindex.php
files fromhttp://example.com/wp
tohttp://example.com
. - Open
index.php
athttp://example.com
and replace:
规定(./可湿性粉剂博客 - 的header.php');
与
规定(./ WP /可湿性粉剂博客 - 的header.php');
使用6登录 http://example.com/word$p$pss/wp-admin/
。
7.转到固定链接设置更新的永久链接结构。
require('./wp/wp-blog-header.php');
6. Login using http://example.com/wordpress/wp-admin/
.
7. Go to the permalinks settings to update the Permalink structure.
这就是全部。该WP博客是在 http://example.com
从现在开始访问。
That's all. The WP blog is accessed at http://example.com
from now on..
这篇关于通过隐藏子目录的.htaccess中显示的网址是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!