服务器被重装,我负责的模块很多都调不通,特别是涉及到很多url重写功能的,赶紧看看为什么。
打开 /usr/local/apache/conf/httpd.conf 配置文件,找到我那个虚拟主机的配置:
<VirtualHost *:80>
ServerAdmin heiyeluren@unixsky.net
DocumentRoot /usr/www/heiyeluren
ServerName heiyeluren.unixsky.net
ErrorLog logs/cal-error_log
CustomLog logs/cal-access_log common
</VirtualHost>
没有看出问题来呀?
难道是我的 .htaccess 文件不对?赶紧打开 /usr/www/heiyeluren/.htaccess 看看:
<IfModule mod_rewrite.c>
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]
<IfModule mod_rewrite.c>
也没看出异常来呀~~~~ 赶紧找资料。。。原来是 httpd.conf 配置文件少了东西,修改 /usr/local/apache/conf/httpd.conf 再上面虚拟主机的上面加上内容,结果如下:
<VirtualHost *:80>
<Directory "/usr/www/heiyeluren">
AllowOverride All
Options Indexes FollowSymlinks MultiViews
Order allow,deny
Allow from all
</Directory>
ServerAdmin heiyeluren@unixsky.net
DocumentRoot /usr/www/heiyeluren
ServerName heiyeluren.unixsky.net
ErrorLog logs/cal-error_log
CustomLog logs/cal-access_log common
</VirtualHost>
嘿嘿,重启apache,再测试,能访问了。
其实就是加上了:
<Directory "/usr/www/heiyeluren">
AllowOverride All
Options Indexes FollowSymlinks MultiViews
Order allow,deny
Allow from all
</Directory>
针对某个目录的设置。
Apache服务器URL重写问题解决
服务器重装后,涉及url重写功能的模块调不通。作者先查看Apache的httpd.conf配置文件和.htaccess文件,未发现异常。经查找资料,发现是httpd.conf配置文件缺少内容,添加针对特定目录的设置后,重启Apache,问题解决。
152

被折叠的 条评论
为什么被折叠?



