w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Redirect /index.php to /folder/index.php without showing a 301 redirect or change in url

Is it possible to have the redirect without showing a 301 redirect (instead showing a 200)?

This is called a rewrite, not a redirect. A redirect is a response sent to the browser to load a different URL, and when it does this, it'll show in the location bar what it loaded. A rewrite stays entirely on the server's end and the browser knows nothing about it, so the location bar doesn't change because it's never been told to load a new URL.

Is it possible to have the index.php redirect without showing a 301 redirect (instead showing a 200) or change in url?

You want something like this:

RewriteCond %{HTTP_HOST} domain1.com$ [NC]
RewriteCond %{REQUEST_URI} !^/folder1/
RewriteRule ^(.*)$ /folder1/$1 [L]

etc.

Notice that there is no R=301 flag, which tells mod_rewrite to redirect the browser.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.