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: test.com/hello
New URL: test.com/tmp/hello
(But there should be an exception to this redirect this should not work for test.com/index.php)
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