0

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!

1
  • Verify whether your .htaccess is enabled or not, by putting some garbage (random) text on top of your .htaccess and see if it generates 500 (internal server) error or not when you visit your page in browser. 500 error means .htaccess is enabled. Commented Sep 14, 2018 at 17:45

1 Answer 1

1

You can use:

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^news/cat/(.+)$ http://exemple.com/\x2523/id/$1 [NC,L,R=301]
Sign up to request clarification or add additional context in comments.

6 Comments

the # is coming out as %23, do you know how to keep the actual hash in the url?
Try with \%23
same result using \%23
And with \x2523 ?
by re organizing htaccess it worked with the original hash, thank you
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.