so heres the scenario:
i acquired your blog around the root directory of my host i quickly located some application on the subfolder named fsGallery. now, i purchased a brand new domain for my blog and the other domain for my application. ii want to be aware of proper htaccess 301 redirects to ensure that me to redirect that old sites for their particular new domain names
here is a sample dir structure:
root/ /application [blog]
attempting to: redir /application to newdomainforapp.com redir [blog] to newdomainforblog.com
also, initially, my application accustomed to accept url parameters such as this: application/user/1234567
and so i would like to: redir /application/user/ to newdomainforapp.com/profile/
can anybody assist me to plox?
Possibly not programming-related, but anyway: the best way to do that is incorporated in the virtual host configuration file (i.e. within the
<VirtualHost *:80> ...
</VirtualHost> section), not within an
.htaccess file. The directives to make use of are
RedirectMatch permanent /application/user/([-9+]) http://newdomainforapp.com/profile/$1 Redirect permanent /application http://newdomainforapp.com Redirect permanent / http://newdomainforblog.com
It appears RewriteRules should work fine.
RewriteEngine on RewriteRule ^/?application/user/([-9]+) http://newdomainforapp.com/profile/$1 [R=301,L] RewriteRule ^/?application(/(.*))?$ http://newdomainforapp.com/$2 [R=301,L] RewriteRule ^/?(.*) http://newdomainforblog.com/$1 [R=301,L]
You'll most likely have to adjust the groups to redirect articles correctly.