如何摆脱我网站网址中的 /webroot/page/home

How to get rid of the /webroot/page/home in the url of my website?

本文关键字:webroot page home 何摆脱 网站      更新时间:2023-09-26

我已经做了一个网站,现在想把它放到网上。它已经在域上,但存在问题。URL仍然很奇怪,我想修复它但不知道如何修复。

如何:example.com/webroot/page/home - example.com/webroot/page/membersInfo/infoBulletin/

应该如何:example.com - example.com/membersinfo/infobulletin

我想摆脱/webroot/page/

多谢

阿诺娜

我使用:Twig,Html,Bootstrap,JS,JQ,CSS,PHP,JSON

一个简单的解决方案是将站点文件夹移动到两个目录上,但我不鼓励这样做。如果您可以保持站点文件井井有条(即使用子目录),您的生活将更轻松。

我认为这样的事情在你的.htaccess中会起作用。如果没有,请告诉我,我会玩它:

#if rewrite engine isn't already on
RewriteEngine On 
#in case you only want to rewrite the path for say, mysite.com, then use this RewriteCond as well
RewriteCond %{SERVER_NAME} mysite.com
#rewrite the request at the root to have /webroot/page in front of it
RewriteRule (.+) /webroot/page$1 [L]