s_p
s_p

Reputation: 4693

htaccess redirect url with parameter variables

I am trying to redirect traffic when user visit my site from a specific url.
* CATEGORY_ID will be alpha_numeric

//domain.net/news/cat/{CATEGORY_ID}

should be redirected to

//other.com/#/id/{CATEGORY_ID}

my attempt from this article

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/news/cat/(.+)$
RewriteRule .* //other.com/#/id/%1 [L,R=301,QSA]

gave a 404 error.

Any help please, thank you!

Upvotes: 0

Views: 60

Answers (1)

Croises
Croises

Reputation: 18671

You can use:

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^news/cat/(.+)$ http://exemple.com/\x2523/id/$1 [NC,L,R=301]

Upvotes: 1

Related Questions