Home Ask Login Register

Developers Planet

Your answer is one click away!

SanJeet Singh February 2016

How to properly redirect all files inside directory with .htaccess?

I have basically two questions.

  1. How do I redirect domain.com/ipc/ to domain.com/category/indexpage/? Also, what happens to http or https version and www or non www version? Are they all redirected without any problem?

  2. Let's say I want to also redirect domain.com/ipc/page to domain.com/category/indexpage/page? I mean are all webpages inside the directory redirected properly? Is it also possible with .htaccess redirection?



Panama Jack February 2016

You can use mod_alias for a simple redirect inside your .htaccess file.

RedirectMatch 301 ^/ipc/(.*)$ /category/indexpage/$1

Also this has no baring on whether it was called with http(s) or www/non www. It just handles the redirect regardless.

Post Status

Asked in February 2016
Viewed 1,875 times
Voted 12
Answered 1 times


Leave an answer

Quote of the day: live life