【发布时间】:2014-09-09 12:48:45
【问题描述】:
我正在使用 Debian Jessie。我想启用 URL 重写。很多网站,比如this blog,建议我编辑
/etc/apache2/sites-available/default
但是,没有这样的文件,但它包含000-default.conf,其中包含以下代码:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
没有包含的行
AllowOverride None
我可以用上面指定的博文中给出的代码覆盖这个文件吗?
之后,我可以在我的 /var/www/html/somesite/ 文件夹中使用以下代码放置一个 .htaccess 文件
RewriteEngine On
RewriteRule ^this/page/thispage this.php?page=thispage
用“this/page/thispage/”覆盖“this.php?page=thispage”?
并且(额外的问题),有没有办法覆盖所有的 GET 请求,所以任何形式为“this.php?variable1=foo&variable2=bar”的链接都会导致形式为“this/variable1/foo/variable2 /bar”?
【问题讨论】:
标签: .htaccess mod-rewrite apache2 debian