【发布时间】:2014-09-22 19:57:08
【问题描述】:
我无法让我的 .htaccess 文件重写 URL。这是我确定的:
- httpd.conf 文件有
LoadModule rewrite_module modules/mod_rewrite.so未注释。 -
<Directory "C:/xampp/htdocs">下的httpd.conf 文件有AllowOverride All。 - phpinfo() 有
mod_rewrite在加载的模块下。
我目前正在使用 XAMPP。
我的主目录是C:\xampp\htdocs\test。
在test 文件夹中,我有一个基本的index.php 文件和.htaccess 文件。
.htaccess 文件内:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$\ http://google.com [L]
#RewriteRule ^(.*)$\ index.php/$1 [L]
#RewriteBase /test/
-
.htaccess文件正在被访问,因为当我在文件中扔垃圾时,当我访问我的index.php页面时,我得到一个500 error。 - 底部两条注释规则是我打算使用的,但现在只要重定向到 google 就会让我知道它是否有效。我已经使用注释规则进行了尝试,但没有运气。
-
.htaccess规则确实适用于我的 Web 服务器。
当我访问我的index.php 页面时,我没有被重定向。它只是正常加载页面。
我花了 4 个多小时寻找解决方案,但没有任何运气。我已经尝试过 XAMPP 和 EasyPHP,但两者的问题都是一样的。
如果有人有任何想法或建议,我将非常感激。
编辑:
以下是我在重新启动 PC 后启动 Apache 时的错误日志:
[Thu Jul 31 18:05:22.365119 2014] [ssl:warn] [pid 6380:tid 384] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jul 31 18:05:22.396117 2014] [core:warn] [pid 6380:tid 384] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Thu Jul 31 18:05:22.512122 2014] [ssl:warn] [pid 6380:tid 384] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jul 31 18:05:22.851147 2014] [mpm_winnt:notice] [pid 6380:tid 384] AH00455: Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.11 configured -- resuming normal operations
[Thu Jul 31 18:05:22.851147 2014] [mpm_winnt:notice] [pid 6380:tid 384] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13
[Thu Jul 31 18:05:22.851147 2014] [core:notice] [pid 6380:tid 384] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Thu Jul 31 18:05:22.853142 2014] [mpm_winnt:notice] [pid 6380:tid 384] AH00418: Parent: Created child process 3936
[Thu Jul 31 18:05:23.241170 2014] [ssl:warn] [pid 3936:tid 416] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jul 31 18:05:23.388142 2014] [ssl:warn] [pid 3936:tid 416] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jul 31 18:05:23.423146 2014] [mpm_winnt:notice] [pid 3936:tid 416] AH00354: Child: Starting 150 worker threads.
【问题讨论】:
标签: php apache .htaccess mod-rewrite xampp