Reputation: 1445
Folks,
This is easy, but I cannot seem to get this right, any help appreciated.
I if someone goes to a URL
http://test.api.com/somestuff I want it to redirect to
http://test.api.com/en/api/somestuff
However my rewrite rule keeps resulting in a endless redirect - can someone spot the error?
RewriteCond %{REQUEST_URI} !^(/en/api/).*
RewriteRule ^(.*)$ http://%{HTTP_HOST}/en/api/$1 [R,L]
Upvotes: 0
Views: 45
Reputation: 9110
Try this (the slash in the RewriteRule regex is the main difference):
RewriteCond %{REQUEST_URI} !^/en/api/.*
RewriteRule ^/(.*)$ http://%{HTTP_HOST}/en/api/$1 [R,L]
Upvotes: 1