将域名指向运行XAMPP和wordpress的服务器ip

时间:2014-07-19 22:26:13

标签: wordpress dns ip xampp

我在我的Windows服务器上安装了XAMPP并安装了Wordpress XAMPP模块。我还买了一个域名指向我的服务器ip。事情是,我希望当人们进入mydomain.com时,mydomain.com会在地址栏中显示,并且在浏览时会一直显示。

首先,我尝试将域名指向我的IP,当我转到mydomain.com时,它会显示mydomain.com/xampp

然后我尝试改变:DocumentRoot "C:\xampp\htdocs" <Directory "C:\xampp\htdocs"> 在C:\ xampp \ apache \ conf

中的httpd文件中

DocumentRoot "C:\xampp\apps\wordpress\htdocs" <Directory "C:\xampp\apps\wordpress\htdocs">

但是这次当我进入mydomain.com时,它会重定向到myipaddress.com/wordpress

我想要的只是: 1)当有人进入mydomain.com时,他会看到我的wordpress主页。 2)每当用户浏览mydomain.com时,他总是会看到mydomain而不是myipaddress。

任何帮助将不胜感激。 此致!

1 个答案:

答案 0 :(得分:3)

在httpd文件的底部输入:

Alias /wordpress "C:/xampp/htdocs/wordpress/"
<Directory "C:/xampp/htdocs/wordpress/">
AllowOverride All
Order allow,deny
Allow from all
</Directory>

请注意,我上面说的目录是默认目录的示例。我很难找到你的目录,但上面的例子应该有意义。在httpd文件上键入代码后,转到xamp / apache / conf / extra /目录并打开httpd-vhosts文件。在httpd-vhosts文件的底部输入:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.yourdomain.com
ServerAlias yourdomain.com
ServerAdmin email@yourdomain.com
DocumentRoot "C:\xampp\htdocs\wordpress"
</VirtualHost>

如果您已输入此行,请仔细检查您的主机文件:

127.0.0.1     yourdomain.com

重新启动Apache网络服务器。希望这有帮助!

相关问题