.htaccess: Redirect without changing url

.htaccess, regex

Solution

Because you provide a full URL in your rewrite rule it is automatically treated as a redirection. Replace the full URL with just a slash and it should work, i.e.:

RewriteCond %{REQUEST_URI} ^/tour
RewriteRule ^(.*)$ / [P] 

You can even shorten it down to:

RewriteEngine on
RewriteRule ^/?tour.* / [P]

Problem

I would like to have a URL be redirected to a different page on the same domain but without the browser changing the URL. So the page `www.mydomain.co.uk/tour/` should point towards `www.mydomain.co.uk/` but without changing. I have looked at a lot of similar questions on Stackoverflow but all the solutions seem to change the URL for me. CODE: ``` RewriteEngine On Options +FollowSymLinks RewriteCond %{REQUEST_URI} ^/tour RewriteRule ^(.*)$ http://www.mydomain.co.uk/ [L] ```

Original source