繁体   English   中英

.htaccess直接域到子目录

[英].htaccess direct domain to subdirectory

我正在尝试将www.example.com重定向到我的Web服务器上的/ example /,但它似乎只重定向了index.php页面。 另一个问题是,当我希望主文件显示为tunedu.com时,主文件显示为http://tunedu.com/tunedu/

现场示例:
该页面有效: http : //tunedu.com/tunedu/
该页面不起作用: http : //tunedu.com/school.php?id=75

我尝试的任何正则表达式更改最终都会破坏一切。 .htacess代码是这样的:

RewriteEngine on
RewriteRule ^$ /tunedu/ [L]

谢谢。

进行此操作的正确方法是在Web服务器(Apache,nginx或其他服务器)上设置VirtualHosts。 为此使用htaccess似乎很痛苦。

假设您正在使用Apache,这是一个有用的链接: http : //httpd.apache.org/docs/current/vhosts/examples.html

我不确定为什么不使用VirtualHost进行设置。

但是,如果您想使用mod_rewrite方式,这里是一个有用的链接:

http://httpd.apache.org/docs/2.2/rewrite/vhosts.html

希望对您有所帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM