.htaccess - Redirect Sub Directory Index File -


basically redirecting old category page new category page. issue old category found @ both www.domain.com/category/ , www.domain.com/category/index.shtml.

any links on site point www.domain.com/category/index.shtml that's url have redirect in .htaccess.

but there rare cases www.domain.com/category/ being found , not redirecting because doesn't match redirect rule.

how can redirect both these urls in 1 .htaccess line?

essentially i'm trying this:

redirect 301 /category/ http://www.domain.com/new-category/ redirect 301 /category/index.shtml http://www.domain.com/new-category/ 

the issue being, first rule encapsulate inside of /category/, don't want.

and ideally want in 1 line, there quite number need redirected , unfortunately can't redirectmatch them.

is possible?

to match if there's nothing after /category/ or index.shtml, can use redirectmatch directive:

redirectmatch 301 ^/category/(index.shtml)?$ http://www.domain.com/new-category/ 

note parts of expression:

  • ^ anchor beginning of url
  • (index.shtml) group
  • ? quantifier, makes previous unit - in case group - optional
  • $ anchor end of url

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -