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]
You should use iframe html tag in page layout for the url of the browser remain www.example.com, when user navigates between pages. not redirect nor rewrite are not suitable for these purposes.
Force the use of HTTPS instead of HTTP for your website If you want to force your website to use HTTPS, you need to use the RewriteEngine module in the . htaccess file. First of all, you need to turn on the RewriteEngine module in the . htaccess file and then specify the conditions you want to check.
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]
1- Use [P] instead of [L]
2- Use $s at the end of second line to have a set of urls redirects and remove / at the end of it too.
The code will look like this:
RewriteCond %{REQUEST_URI} ^/tour RewriteRule ^(.*)$ /$1 [P]
which treats with more than the index page of the folder tour.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With