.htaccess for redirecting to localhost project root

冷暖自知 提交于 2019-12-12 06:21:07

问题


I have my PHP localhost project in folder named myproject in XAMPP localhost directory. Inside this project I need to use some hyperlinks, for example:

<a href="/">Home</a>

if I am on:

http://localhost/myproject/something

On production server this get me to the root of project (home), but on localhost I get:

http://localhost/xampp/

instead of

http://localhost/myproject

How can I do this? I guess it will be something with .htaccess file. Thank you for advice


回答1:


Search in your httpd.conf xampp and replace by myproject and restart your web server :

DocumentRoot "C:/.../xampp/.."

and <Directory "C:/..../xampp/../"> ...



来源:https://stackoverflow.com/questions/28026975/htaccess-for-redirecting-to-localhost-project-root

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