0

My url is changing and for example now it is ..safety-bathroom then is changing to safety-bathroom-1 and so on, to avoid daily changing rule in htaccess I would like to have a rule which will do regardless if the url is -1 or -2 or -any other incremented number

To rewrite url I tried like this:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^browse/home\-safety/bathroom\-safety(\-*)/$ /browse/home-
safety/bathroom-safety/? [L,R=301]
</IfModule>

What should I do to make it work ? Any help would be GREATLY appreciated. Current code:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^browse/home-safety/bathroom-safety-(.+?)(-[0-9]+)?/$ 
/browse/home-safety/bathroom-safety/$1 [L,R=301]
</IfModule>

:( still not redirecting ...

  • Welcome to SuperUser! Can you edit your post in order to include what is expected from your script? It is hard to explain why it doesn't work when we don't know what it's supposed to do in the first place... – Nathan.Eilisha Shiraini Jul 21 '17 at 14:10
  • updated my question :) – Rob D. A. Jul 21 '17 at 14:13

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.