siannone
siannone

Reputation: 6763

Apache RewriteRule: bad flag delimiters

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.

Upvotes: 1

Views: 13297

Answers (3)

Olivier Pons
Olivier Pons

Reputation: 15778

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]

Upvotes: -1

SuperTron
SuperTron

Reputation: 4233

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.

Upvotes: 1

user142162
user142162

Reputation:

Remove "to":

RewriteRule .* public/index.php

Documentation

Upvotes: 1

Related Questions