问题描述:

I have a Two URLs

NEW URL :

http://host.ip.address/nl/business/producten-en-diensten/gsm-en-smartphones/samsung-galaxy-j1-2016-zwart

OLD URL :

http://host.ip.address/nl/producten-en-diensten/gsm-en-smartphones/samsung-galaxy-j1-2016-zwart

when in request NEW URL from browser it should retrieve content from OLD URL and the URL should not change in browser.

I have tried the below rule in .htaccess it is rewriting and redirecting to the OLD URL which should not do in my case

RewriteEngine on

RewriteRule (^|.*?/)nl/business/(.*)$ /$1nl/$2 [L,R=301]

网友答案:

It is not possible to do a redirect and keep the original URL in the address bar." This is because a redirect, by definition, involves telling the browser to ask for the requested resource at a different URL. So the browser updates its address bar and uses the new URL.

The simplest way would be use a rewrite, not a redirect. An internal rewrite simply serves content from a local file-path that is different from the requested local URL-path.

You can use something easy like this.

RewriteEngine On
RewriteRule nl/producten-en-diensten/gsm-en-smartphones/samsung-galaxy-j1-2016-zwart nl/business/producten-en-diensten/gsm-en-smartphones/samsung-galaxy-j1-2016-zwart

You may need to also add

Options +FollowSymLinks
相关阅读:
Top