如何强制网站URL与域地址相同 [英] How to force website URL to remain the same as the domain's address

查看:142
本文介绍了如何强制网站URL与域地址相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我所拥有的:

  • 具有FTP访问权限的免费托管( www.example.com )
  • 基于Wordpress的网站,其Wordpress实例安装在public_html根目录( www.example.com/wpsite/)的子文件夹中
  • 地址为 www.mydomain.net 的付费域名,该域名已使用其DNS地址存放在 www.example.com 上.
  • A free hosting with FTP access (www.example.com)
  • A Wordpress-based website, with the instance of the Wordpress installed in a sub-folder of the public_html root directory (www.example.com/wpsite/)
  • A paid domain with an address of www.mydomain.net, which has been parked on the www.example.com using their DNS addresses.

我遇到的问题如下:

我希望能够在浏览器的地址栏中输入我的域地址,并访问 www.example.com/wpsite ,而无需进行任何可见的重定向.我希望浏览器的地址栏包含 www.mydomain.net ,并可能添加/wpsite/.

I want to be able to write my domain's address in the browser's address bar and reach www.example.com/wpsite without any visible form of redirection. I want the browser's address bar to contain www.mydomain.net, with the plausible addition of /wpsite/.

我设法达到所需效果的最接近方法是使用php的标头位置脚本,但这会修改​​地址.发生什么情况是,当我尝试访问 www.mydomain.net 时,我将被重定向到 www.example.com/wpsite ,同时我希望页面能够正确加载,显然,我希望该地址与域的地址保持相同.

The closest I have managed to get to the desired effect was by using php's header location script, but that modifies the address. What happens is, as soon as I try to access www.mydomain.net I am being redirected to www.example.com/wpsite, and while I want the page to load correctly, obviously, I want the address to remain the same as the domain's address.

这是我无济于事的内容:

  • php的标头位置脚本
  • 修改 .htaccess 文件-最终导致重定向错误
  • jQuery/JavaScript window.history.pushstate -没用
  • php's header location script
  • modifying the .htaccess files - ended up causing a redirection error
  • jQuery/JavaScript window.history.pushstate - it just didn't work

实现我的目标的最佳方法是什么?是以上之一吗? 还是将Wordpress实例从/wpsite/子文件夹移动到要剪切的根目录中?

What would be the best way to achieve my goal? Is it one of the above? Or is moving the Wordpress instance from the /wpsite/ subfolder into the root directory going to cut it?

我将非常感谢您提供一个答案-我还没有找到答案,我真的很绝望.

I would be very grateful for an answer - I did not manage to find it yet, and I am getting truly desperate.

推荐答案

只需从"wpsite"到根目录中取出一个index.php文件.

just take out a index.php file from "wpsite" to root directory.

并编辑index.php文件并更改此行代码.

and edit the index.php file and change this line of code.

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

更改

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

然后打开数据库并找到wp_option表并找到一个条目

then open your database and find the wp_option table and find one entry

option_name = home

用您的域替换option_value.

然后运行,我希望它能正常工作. 来自此站点的参考

then run i hope this is working. reference from this site

这篇关于如何强制网站URL与域地址相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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