【发布时间】:2014-06-03 03:25:54
【问题描述】:
我的网站位于/srv/http/site-dir/,并在其根目录.htaccess 中包含以下内容:
Options -MultiViews
RewriteEngine On
Options -Indexes
RewriteBase /site-dir/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
它以这种方式工作,但现在我想将这些规则移动到 httpd-vhosts.conf 文件,所以我需要更改以使其从那里工作,从而避免使用我阅读的 .htaccess 是如果您可以访问您的主 .conf 文件,可以进行床上练习吗?
编辑: 将其输入我的 httpd-vhosts.conf 以按照建议尝试但没有成功。
<VirtualHost *:80>
DocumentRoot "/srv/http/site-dir"
ServerName project-site-dir.my
ServerAlias www.project-site-dir.my
Options -MultiViews -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^/site-dir/(.+)$ /site-dir/index.php?url=$1 [QSA,L]
ErrorLog "/var/log/httpd/project-site-dir.my-error_log"
CustomLog "/var/log/httpd/project-site-dir.my-access_log" common
</VirtualHost>
【问题讨论】:
标签: apache .htaccess mod-rewrite httpd.conf