问题
This is my .htaccess file
# Redirect every request to index.php
RewriteBase /
RewriteEngine on
RewriteRule .* to public/index.php
And i'm receiving the following error in the error.log:
RewriteRule: bad flag delimiters
What's wrong with the .htaccess file? (I just started stying mod_rewrite module).
Edit: the .htaccess file is in the site's root.
回答1:
Remove "to
":
RewriteRule .* public/index.php
Documentation
回答2:
AFAIK, you don't need a "to" in the rewrite rule. just delete that word and it should be ok.
RewriteRule .* public/index.php
The docs go into this in depth.
回答3:
The other ones are right, but don't forget to keep what's after the ?
in the URL, it's the QSA
flag, like this:
# Redirect every request to index.php
RewriteBase /
RewriteEngine on
RewriteRule .* public/index.php [QSA]
来源:https://stackoverflow.com/questions/8717969/apache-rewriterule-bad-flag-delimiters