Reputation: 1122
I need to redirect any www.mysite.com/anything/anything OR www.mysite.com/anything AND EXCLUDE www.mysite.com/app
TO www.mysite.com/app
Of course I want to exclude is optional. It would just be an extra redirect which would take extra time I suppose, it would be nice to have it excluded though.
I found these basic examples http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html and have done this:
RewriteRule ^*/*/$ /app
RewriteRule ^*/$ /app
but it doesn't work plus I still don't know how to exclude /app
Help please?
UPDATE
I think .* stands for 0 or more dots in regular expressions, my examples are completely wrong, I need anything syntax instead of the dot you used in your answers.
Upvotes: 0
Views: 385
Reputation: 136
Does this work for you?
RewriteEngine on
RewriteRule ^.*$ app/ [L]
Unfortunately it doesn't exclude the right path. But try it first.
Upvotes: 2
Reputation: 785316
Put this code in your .htaccess under DOCUMENT_ROOT:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^(?!app/).*$ app [L,NC]
Negative lookahead in above RewriteRule will redirect everything except a URI that starts with /app/
to /app
.
Upvotes: 0
Reputation: 997
You could try this:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/app$
RewriteRule ^.*$ /app [L]
Upvotes: 3