【问题标题】:.htaccess with redirection won't work带有重定向的 .htaccess 将不起作用
【发布时间】:2013-06-12 14:15:06
【问题描述】:

我在我的 linuxmint 15 中启用了 mod_rewrite。但是 .htaccess 不起作用。这是我的apache配置

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/xampp/htdocs
    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>
    <Directory /var/www/xampp/htdocs/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

请帮帮我。问我是否需要任何信息。

这也是我的 htaccess 文件

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /mehedi.php [L]
</IfModule>

htaccess 文件位于“/var/www/xampp/htdocs/”目录中。

谢谢

【问题讨论】:

  • 除非文件或文件夹存在,否则应该将所有内容重定向到mehedi.php。有什么问题/错误?

标签: linux apache .htaccess mod-rewrite


【解决方案1】:

您的 apache 错误日志中有什么有用的信息吗?我建议检查您的 httpd.conf 以了解正在设置的任何选项指令。对于您已配置的 DocumentRoot 上方的那个或多个目录,您的 AllowOverride 选项可能设置为 None 或“All”以外的其他内容。希望这会有所帮助——祝你好运!

【讨论】:

    【解决方案2】:

    您是否激活了重写模块? (sudo a2enmod rewrite + sudo service apache2 restart)

    【讨论】:

      猜你喜欢
      • 2012-03-16
      • 2015-03-07
      • 2015-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-23
      相关资源
      最近更新 更多