I have hundreds of links like this:
http://www.domain.com/index.php?tag=value
I want to redirect all links to
http://www.domain.com/value/
Example:
Link1 http://www.domain.com/index.php?tag=LW1fdX49tR redirect to:http://www.domain.com/LW1fdX49tR/
http://www.domain.com/index.php?tag=LW1fdX49tR
http://www.domain.com/LW1fdX49tR/
Link2 http://www.domain.com/index.php?tag=A3kh0QLIrc redirect to:http://www.domain.com/A3kh0QLIrc/
http://www.domain.com/index.php?tag=A3kh0QLIrc
http://www.domain.com/A3kh0QLIrc/
Link3 http://www.domain.com/index.php?tag=vXwNR4U9qY redirect to:http://www.domain.com/vXwNR4U9qY/
http://www.domain.com/index.php?tag=vXwNR4U9qY
http://www.domain.com/vXwNR4U9qY/
etc.
How can i do this? Thank!
, , , , URL- . . THE_REQUEST , URL , . .
#External redirect with THE_REQUEST trick; change R to R=301 when everything works correctly RewriteCond %{THE_REQUEST} ^(GET|POST)\ /index\.php\?tag=(.*)\ HTTP RewriteRule ^ /%2? [R,L] #Internal rewrite RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?tag=$1 [L]
Source: https://habr.com/ru/post/1532892/More articles:Difference between DI implementation by extending DefaultControllerFactory versus implementation of IDependencyResolver - c #Уведомление Android Push (медленное) - performanceTypeError: templateSpec.call is not a function - handlebars.jsAggregate function with a list variable - rHow to get current specification handle from beforeEach in jasmine test? - javascriptУгловая граница, разделяющая элементы li - htmlSchrodinger object: WPF property will not bind / update unless I check its value on the code side? - c #Intra-unit breaks with many children - htmlAndroid SELinux ошибки в logcat - androidHow to get the payload from iBeacon / BLE ads - linuxAll Articles