在 Wordpress 的所有页面中隐藏子文件夹 url [英] Hide subfolder url in all pages Wordpress

查看:67
本文介绍了在 Wordpress 的所有页面中隐藏子文件夹 url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将该站点安装在现有站点的子文件夹中.当我打开主页时,网址如下所示:www.nextarconsulting.com/SitoNextar/

I have installed the site in a subfolder of an existing site. When I open the home page, the url looks like this: www.nextarconsulting.com/SitoNextar/

我希望它出现在:www.nextarconsulting.com

I would like it to appear instead: www.nextarconsulting.com

我通过 .htacces 尝试了不同的解决方案,但没有一个成功!

I tried different solutions via .htacces but no one works!

PS:旧站点(我在其中安装了新 wordpress 的子文件夹)与新站点具有相同的 url,因此在修改新站点的 .htaccess 后,我有 2 个相等的链接重定向.这会发生冲突吗?

PS: The old site (where I have the subfolder with the new wordpress installation) has the same url as the new site, so I have 2 equal link redirects after I modify the .htaccess of the new site. Can this be in conflict?

这是我的 .htaccess 文件:

Here is my .htaccess file :

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

# END WordPress
# BEGIN Hotlinking

# END Hotlinking

我还希望看到站点的其他页面不再出现在文件夹路径中.例如:www.nextarconsulting.com/SitoNextar/contacts.html 必须变成www.nextarconsulting.com/contacts.html

I would also like to see that the other pages of the site no longer appear on the folder path. For example: www.nextarconsulting.com/SitoNextar/contacts.html must become www.nextarconsulting.com/contacts.html

推荐答案

您可以通过 Wordpress 设置、index.php 和 .htaccess 文件执行此操作.

You do this through Wordpress Settings, the index.php and .htaccess files.

  1. 转到管理区域中的常规设置.您将看到WordPress 地址"和站点地址"字段将具有相同的 URL.您需要更改站点地址选项以指向您的根域,即http://www.nextarconsulting.com保持 WordPress 地址选项不变.

  1. Go to the General Settings in your Admin area. You will see that "WordPress Address" and "Site Address" fields will have the same URL. You need to change the Site Address option to point to your root domain, i.e. http://www.nextarconsulting.com and leave WordPress Address option as it is.

.htaccess文件从安装子文件夹(即SitoNextar)复制到域根文件夹

Copy the .htaccess file from the installation subfolder (i.e. SitoNextar) to the domain root folder

将站点的index.php文件从安装子文件夹(即SitoNextar)复制到域根文件夹,编辑如下:

Copy the site's index.php file from the installation subfolder (i.e. SitoNextar) to the domain root folder, and edit it as follows:

改变这一行:

require( dirname( __FILE__ ) . '/wp-blog-header.php' );

包含安装文件夹,例如:

to include the installation folder, e.g.:

require( dirname( __FILE__ ) . '/SitoNextar/wp-blog-header.php' );

注意事项:

执行此操作后,您可能还需要重新保存永久链接.

You might also need to resave your permalinks after doing this.

您仍然登录并使用安装文件夹中的管理区域(即 www.nextarconsulting.com/SitoNextar/wp-admin)

You still login and use the Admin area from the installation folder (i.e. www.nextarconsulting.com/SitoNextar/wp-admin)

参考:[如何从您的 WordPress 网站 URL 中删除/wordpress/](http://www.wpbeginner.com/wp-tutorials/how-to-get-rid-of-wordpress-from-your-wordpress-site-url/

Reference: [How to Get Rid of /wordpress/ From your WordPress Site URL](http://www.wpbeginner.com/wp-tutorials/how-to-get-rid-of-wordpress-from-your-wordpress-site-url/

这篇关于在 Wordpress 的所有页面中隐藏子文件夹 url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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