初学者的Apache URL重写问题 [英] Beginner Apache URL Rewrite Question
本文介绍了初学者的Apache URL重写问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想弄清楚,如果我在正确的道路上 - 重写的URL在我的例子是AP preciated其他详细信息
I'm just trying to figure out if I'm on the right path - additional details on rewriting the URL in my example would be appreciated.
我已经安装了CMS程序和只想说www.example.com指出,以www.example.com/cms。我只是想知道,如果通过URL重写阿帕奇是实现这一目标的最佳方式是什么?
I have installed a CMS program and would simply like that www.example.com be pointed to www.example.com/cms. I just want to know if URL rewriting through apache is the best way to accomplish this?
感谢您。
推荐答案
在重定向 http://example.com/来 http://example.com/cms/ :
<IfModule mod_rewrite.c>
RewriteEngine On
RewritRule ^/?$ /cms/
</IfModule>
重定向,否则会一直404D的所有URL开始/ CMS /:
Redirecting all urls which otherwise would've 404d to start with /cms/:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /cms/$1 [L]
</IfModule>
重定向的所有URL / CMS /:
Redirecting all urls to /cms/:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ /cms/$1 [L]
<Directory /var/www/html/cms/> #change this to the correct path
RewriteEngine Off
</Directory>
</IfModule>
这篇关于初学者的Apache URL重写问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文