I want to redirect one URL to another without changing the Browser URL
www.example.com/abc/(.*).xml should redirect to www.example.com/abc/xyz/index.htm?file=$1
But the Browser should display www.example.com/abc/(.*).xml
Sometimes you may need to redirect domain pages without changing URL in Apache web server. Here’s how to redirect and keep original URL using .htaccess. You can use it to redirect domain or page without changing URL. Here are the steps to redirect and keep original URL using htaccess.
Here are the steps to redirect www to non-www in Apache htaccess file. Please ensure that you have enabled mod_rewrite in your Apache web server configuration. Only then your htaccess configuration will be applied by Apache server.
The Redirect directive lets you execute simple and one-page redirects with Apache. It connects an old URL with a new one by asking the client to fetch the resource again at the new location. The Redirect directive requires at minimum two arguments: the old URL and the new URL. To accomplish the redirect, add the following lines to your server ...
The Redirect directive lets you execute simple and one-page redirects with Apache. It connects an old URL with a new one by asking the client to fetch the resource again at the new location.
You can use a RewriteRule
:
RewriteEngine On
RewriteRule /abc/(.*)\.xml$ /abc/xyz/index.htm?file=$1 [L]
Make sure you have mod_rewrite
enabled and put this either in your VirtualHost
config, or in a .htaccess
file in your DocumentRoot
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