News Ticker

Using htaccess-all types of redirection from subdomains or directory

By Unknown - Friday, 13 November 2015 No Comments
1) Redirect from subdirectory (http://www.unknowndevice64.info/dir/{url}) to root folder
http://www.unknowndevice64.info/{url}
-[code by unknowndevice64]-
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.unknowndevice64.info
RewriteRule ^dir/(.*)$ http://www.unknowndevice64.info/$1 [L,R=301]
[/code end]

2) Redirect from subdirectory (http://www.unknowndevice64.info/dir/$) to root folder
http://www.unknowndevice64.info/
-[code by unknowndevice64 Permanent 301 ]-
RedirectMatch 301 ^/dir/$ http://www.unknowndevice64.info/
-OR-
RedirectMatch permanent ^/dir/$ http://www.unknowndevice64.info/
[/code end]

-[code by unknowndevice64 Temporary 302 ]-
RedirectMatch 302 ^/dir/$ http://www.unknowndevice64.info/
-OR-
RedirectMatch temp ^/dir/$ http://www.unknowndevice64.info/
[/code end]

3) Redirect from subdirectory (http://www.unknowndevice64.info/dir/{url}) to root folder
http://www.unknowndevice64.info/page.html
-[code by unknowndevice64]-
RedirectMatch 301 ^/dir/.*$ http://www.unknowndevice64.info/page.html
[/code end]

4) Redirect from subdomain and it's directory (temp.unknowndevice64.info/dir/{url}) to
http://www.unknowndevice64.info{url}
-[code by unknowndevice64]-
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^temp.unknowndevice64.info
RewriteRule ^subdir/(.*)$ http://www.unknowndevice64.info/$1 [L,R=301]
[/code end]

5) Redirection from subdir (http://www.unknowndevice64.info/dir/{url} ) to subdomain
(http://temp.unknowndevice64.info/{url})
-[code by unknowndevice64]-
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.unknowndevice64.info
RewriteRule ^dir/(.*)$ http://temp.unknowndevice64.info/$1 [L,R=301]
[/code end]

6) Redirection from subdir (http://www.unknowndevice64.info/dir/{url}) to subdomain’s subdir
(http://temp.unknowndevice64.info/dir/{url})
-[code by unknowndevice64]-
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.unknowndevice64.info
RewriteRule ^dir/(.*)$ http://temp.unknowndevice64.info/dir/$1 [L,R=301]
[/code end]

7) Redirection from subdir (http://www.unknowndevice64.info/dir/) to subdomain
(http://temp.unknowndevice64.info/)
-[code by unknowndevice64]-
# 301 redirect for main pages
RedirectMatch 301 ^/dir/$ http://temp.unknowndevice64.info/
[/code end]

8) Redirection from subdir (http://www.unknowndevice64.info/dir/page.html) to subdomain’s
sepcific page (http://temp.unknowndevice64.info/page.html)
-[code by unknowndevice64]-
# permanent redirect to a particular page
RedirectMatch 301 ^/dir/$ http://temp.unknowndevice64.info/page.html
[/code end]

No Comment to " Using htaccess-all types of redirection from subdomains or directory "