apache - Redirect ip to url using .htaccess -
I want to redirect from my IP (a host) to my website URL. Earlier I used the following lines in the .htaccess file and it worked fine.
rewrite% {HTTP_HOST} ^ [0-9] + (\ [[0-9] +) {3} [or] rewrite% {HTTP_HOST} ^ www \ .example \. Com $ [nc] revised rule ^ http://example.com/$1 [L, R = 301] The above code has directed my IP to the web url.
I have now changed the code to the following and the IP redirects to a strange URL
rewrite% {HTTP_HOST} ^ [0-9] + (\ [0- 9] +) {3} [or] rewrite% {HTTP_HOST} ^ www. (. +) $ [NC] rewrite rule ^ http: //% 1% {REQUEST_URI} [L, R = 301] I want to use the {REQUEST_URI} feature and Also redirect to my base url. Try
:
rewrite% {HTTP_HOST } ^ [0-9] + (\ [[-9] +) {3} [or] rewrite \% {HTTP_HOST} ^ www \. (. +) $ [Nc] Rev. ^ http: //% {HTTP_HOST}% {REQUEST_URI} [L, R = 301]
Comments
Post a Comment