简体   繁体   中英

htaccess rewrites not working on localhost

While there are many similar posts, I have read them all to no avail. Let me describe my situation in hopes that someone can resolve this issue. I have the following .htaccess file living in /Users/myusername/Sites/domain.com/public_html/.htaccess. The DocumentRoot is set to /Users/myusername/Sites/domain.com/public_html.

RewriteEngine on
options +FollowSymLinks

RewriteBase /demo 
RewriteRule ^/demo/evaluate/1$ /demo/evaluate/index.php?eval_id=1 [L]

Now for the settings:

  1. "LoadModule rewrite_module modules/mod_rewrite.so" in httpd.conf is uncommented.
  2. "AllowOverride All" everywhere

The htaccess redirects work, but for some reason I just keep getting the following error in my error logs:

[Sun Apr 22 11:14:09 2012] [error] [client ::1] File does not exist: /Users/myusername/Sites/domain.com/public_html/demo/evaluate/1

Please let me know if you need any more information.


Honestly, not sure what happened. I did not change anything.

It could have been some magic combination of all of the settings and feedback. But now it is working. It's like a house of cards that I am just going to step back from and marvel at until I accidentally break it again.

尝试将您的RewriteRule更改为:

RewriteRule ^demo/evaluate/1$ demo/evaluate/index.php?eval_id=1 [NC,QSA,L]

Can you please check these two lines and check

RewriteBase /demo 
RewriteRule ^/demo/evaluate/$1 /demo/evaluate/index.php?eval_id=$1 [L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM