通过隐藏子目录的.htaccess中显示的网址是什么? [英] Hide subdir in displayed URL via .htaccess?

查看:501
本文介绍了通过隐藏子目录的.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)

  1. 网站地址(URL)的设置为你希望人们在键入他们的浏览器,以达到您的Word preSS博客地址。
  2. 字preSS地址(URL)的设置是在您的Word preSS核心文件所在的地址。
  1. The Site Address (URL) setting is the address you want people to type in their browser to reach your WordPress blog.
  2. 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.

  1. 设置 - >通用的。
  2. 网站地址(URL)的,进入该目录显示: http://example.com 在这种情况下。没有结尾的斜线。
  3. 保存更改并注销。
  4. 复制的.htaccess 的index.php 文件从的http://例子。 COM / WP http://example.com。
  5. 开启的index.php http://example.com 并替换:
  1. Go to Settings -> General.
  2. In Site Address (URL), enter the directory to show: http://example.com in this case. NO trailing slash.
  3. Save changes and log out.
  4. Copy .htaccess and index.php files from http://example.com/wp to http://example.com.
  5. Open index.php at http://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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆