Forum Moderators: phranque
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !public/
RewriteRule ^(.*)$ public/$1 [L] RewriteEngine on
RewriteBase /public/
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^this-is-old-url-or-something-like-that$ testing [L]
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
# All requests for non-existent files should be rewritten to /public/index.php
FallbackResource /public/index.php
Is this a proper way?
That's first
whitespace, didn't you establish just a few days ago that if you declare more than one RewriteBase, only the last is used?
That's first which is placed in root folder and it sends the traffic to public folder
RewriteCond %{REQUEST_URI} !public/
RewriteRule ^(.*)$ public/$1 [L] main goal is to avoid example.com/public/foo/bar/example,and just to give:
example.com/foo/bar/example
RewriteCond %{THE_REQUEST} /public
RewriteRule ^public/(.*) http://www.example.com/$1 [R=301,L]
and then if you're actually serving content from /public/ then you make a rewrite [L] later on to take care of that. [QSA,L]What's the QSA for? Do your visible URLs also contain query strings? If they don't, there is no need for QSA since you'll never be appending anything.
Without RewriteCond it makes infinite loop and 500 errors.He didn't mean that you should omit the RewriteCond; it's absolutely essential with this rule. He only meant that a RewriteCond applies only to the immediately following RewriteRule. If you need the same condition to apply to multiple rules, you have to say it all over again each time.
http://example.com/?page=2 RewriteRule ^public/(.*) http://localhost/production/kupbytes/ [R=301,L] RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !public/
RewriteRule ^(.*)$ public/$1 [L]