Apache中设置虚拟主机的URL重写功能
来源:互联网 发布:键盘钢琴软件电脑 编辑:程序博客网 时间:2024/06/09 16:26
服务器被重装,我负责的模块很多都调不通,特别是涉及到很多url重写功能的,赶紧看看为什么。
打开 /usr/local/apache/conf/httpd.conf 配置文件,找到我那个虚拟主机的配置:
ServerAdmin heiyeluren@unixsky.net
DocumentRoot /usr/www/heiyeluren
ServerName heiyeluren.unixsky.net
ErrorLog logs/cal-error_log
CustomLog logs/cal-access_log common
没有看出问题来呀?
难道是我的 .htaccess 文件不对?赶紧打开 /usr/www/heiyeluren/.htaccess 看看:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [S=42]
RewriteRule ^share/$ /share.php [QSA,L]
RewriteRule ^(rss|rss2|atom|opml)/tag/([^/]+)/?$ /rss.php?rssver=$1&rsstype=tag&tag=$2 [QSA,L]
RewriteRule ^(rss|rss2|atom|opml)/city/([^/]+)/?$ /feed.php?rssver=$1&rsstype=city&city=$2 [QSA,L]
RewriteRule ^(rss|rss2|atom|opml)/pub/event/?$ /feed.php?rssver=$1&rsstype=pub_event [QSA,L]
RewriteRule ^(rss|rss2|atom|opml)/pub/task/?$ /feed.php?rssver=$1&rsstype=pub_task [QSA,L]
也没看出异常来呀~~~~ 赶紧找资料。。。原来是 httpd.conf 配置文件少了东西,修改 /usr/local/apache/conf/httpd.conf 再上面虚拟主机的上面加上内容,结果如下:
AllowOverride All
Options Indexes FollowSymlinks MultiViews
Order allow,deny
Allow from all
ServerAdmin heiyeluren@unixsky.net
DocumentRoot /usr/www/heiyeluren
ServerName heiyeluren.unixsky.net
ErrorLog logs/cal-error_log
CustomLog logs/cal-access_log common
嘿嘿,重启apache,再测试,能访问了。
其实就是加上了:
AllowOverride All
Options Indexes FollowSymlinks MultiViews
Order allow,deny
Allow from all
针对某个目录的设置。
- Apache中设置虚拟主机的URL重写功能
- Apache中设置虚拟主机的URL重写功能
- Apache中设置虚拟主机的URL重写功能
- apache 配置虚拟主机 url重写功能
- apache中url重写 的研究经历
- apache的url重写
- Apache的URL重写
- Apache虚拟主机中 Options 的设置~~~~~~~显示Apache目录列表
- apache中url重写 例子
- Apache中URL地址重写
- Apache VirtualHost 虚拟主机 ProxyPass 反向代理 RewriteEngine url 重写
- Apache服务器中设置虚拟主机
- 关于apache的url 重写
- apache 的URL重写笔记
- apache服务器的url重写
- Apache下的URL重写
- Apache设置虚拟主机的例子
- Apache下的虚拟主机设置
- 在VC++中使用斷言
- 优化Mysql
- Visual C++ Q&A
- 用GDB调试程序(七)
- 更换博客地址的通知
- Apache中设置虚拟主机的URL重写功能
- 用GDB调试程序(四)
- C++中的名字查找
- [转] PHP开发框架总结
- 用GDB调试程序(五)
- GreaseMokey 里面搞笑的JavaScript代码
- 2006年4月度国际标准化组织C++会议纪要[原文发表时间:2006年5月3日]
- 用GDB调试程序(二)
- 学好VC++的十大良好习惯