Pointing domain name to server ip running XAMPP and wordpress

て烟熏妆下的殇ゞ 提交于 2019-12-10 19:42:06

问题


I installed XAMPP on my windows server and also installed Wordpress XAMPP module. I also bought a domain to point it to my server ip. Thing is , I want that when people enter mydomain.com , mydomain.com shows in the address bar and that it keeps showing while browsing.

First I tried to point the domain to my ip , and when I go to mydomain.com it shows mydomain.com/xampp

Then I tried to changing:DocumentRoot "C:\xampp\htdocs" <Directory "C:\xampp\htdocs"> in httpd file in C:\xampp\apache\conf

to

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

But this time when I enter mydomain.com it redirects to myipaddress.com/wordpress

All I want is: 1)When someone enters mydomain.com , he will see my wordpress home page. 2)Whenever a user is browsing mydomain.com , he will always see mydomain instead of myipaddress.

Any help would be appreciated. Regards!


回答1:


Type this at the bottom of your httpd file:

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

Please take note that the directory that I stated above is a sample of a default directory. I am having a hard time trying to figure out your directory but the above example should make sense. After typing the codes on your httpd file, go to the directory of xamp/apache/conf/extra/ and openup the httpd-vhosts file. Type this at the bottom of the httpd-vhosts file:

NameVirtualHost *:80

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

Double check your host file if you already entered this line:

127.0.0.1     yourdomain.com

Restart your Apache webserver. Hope this helps!



来源:https://stackoverflow.com/questions/24845562/pointing-domain-name-to-server-ip-running-xampp-and-wordpress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!