Rohit Batra Rohit Batra - 6 months ago 50
Apache Configuration Question

Redirect* to* using .htaccess

I've just moved my main domain website to a sub-directory, But the search engines still have the old urls listed in there Index. Till the time fresh URL's get listed.

Is there any way to redirect those requests to that sub-directory. (except index.php)

Old URL:

New URL:

(But there should be an exception to this redirect this should not work for

I tried some codes but it either redirects whole url or throw a 500 Error.

Can anyone suggest something?


You can use this redirect rule in site root .htaccess:

RedirectMatch 301 ^/(?!index\.php|tmp/)(.+)$ /tmp/$1