Reputation: 21893
I am trying to redirect all calls to mysite.com/api/foo/bar/json?param1=1...
to mysite.com/api
I've tried
RewriteEngine On
RewriteRule "^api/?(.*)" "/api" [R=302]
But it doesn't work because it redirects in a loop
Upvotes: 1
Views: 86
Reputation: 41219
You need to exclude the destination path you are redirecting to
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/api/?$
RewriteRule ^api/?(.*) /api [R=302]
Upvotes: 1
Reputation: 6656
First check file permission maybe you don't have to made edit on the .htaccess
file. Then insert this line of code.
RewriteEngine on
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
Upvotes: 0