如何在我的网站的网址中删除/ webroot / page / home?

时间:2014-12-08 15:41:34

标签: javascript php html twitter-bootstrap twig

我已经建立了一个网站,现在想把它放到网上。它已经在域上,但有一个问题。 URL仍然很奇怪,我想解决它,但不知道如何。

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

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

我想摆脱/webroot/page/

非常感谢,

Anona

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

1 个答案:

答案 0 :(得分:0)

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

我认为.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]