All Entries Tagged With: "redirect"
Changing /cpanel to something else
Issue :
How can you access cPanel like, say, http://domainname.com/xyz ? This is for security purposes.
Solution :
This can be done but not recommended as it would not be of much effect security-wise.
Even if you change it, cPanel/WHM would still run on the standard ports (2082/2083 & 2086/2087) which is known to everyone. If you [...]
htaccess redirect for SSL non-www to www
Issue :
Need to redirect https://domain.com to https://www.domain.com for SSL purposes.
Solution :
Use the following code in the htaccess file under the public_html folder for the concerned domain :
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301]
Pointing parked domain to a sub-directory
Issue :
How to point a parked domain to a sub-directory of the main domain without any change in the URL ?
Fix :
This is like making the parked domain function like an add-on domain.
Assuming that the parked domain name is abc.com and the corresponding folder under the main domain is ‘abc’ .This can be [...]
Redirecting every page on the website to index.html
Issue :
While some construction is going on the site, all pages on the website should go to the index page.
Solution :
This can be easily achieved by using the following code in your .htaccess file :
< IfModule mod_rewrite.c >
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
< /IfModule >
htaccess code for redirecting www to non-www
Issue :
Regardless of somebody accessing the site with or without the ‘www’ , it should always go to http://domain.com
Solution :
Use the following htaccess code :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain.com
RewriteRule ^(.*) http://domain.com/$1 [R]
htaccess code for forwarding a domain
Issue :
The old domain ( with and without ‘www’ ) needs to be forwarded to a sub-folder of the new domain.
Solution :
Use the following htaccess code :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
RewriteRule ^(.*)$ http://newdomain.com/folder/$1 [R=permanent,R]
Redirecting to secure connection
Issue :
When someone tries to access the site through the insecure URL (http) , it should redirect ( to https ) automatically.
Fix :
This can be easily achieved by putting the following code in the .htaccess file under ‘public_html’ folder :
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://www.yourdomainname.tld/$1 [L,R]
(Assuming that you have SSL installed on [...]
How to redirect webmail.domain.tld to domain.tld/webmail
Issue :
webmail.domain.tld does not work.
Fix :
1. Create an ‘A’ record for the sub-domain ‘webmail’ in the DNS zone file. It should look like :
domain.com. IN A XX.XX.XXX.XXX
localhost.domain.com. IN A 127.0.0.1
domain.com. IN MX 0 domain.com.
mail IN CNAME domain.com.
www IN CNAME domain.com.
ftp IN A XX.XX.XXX.XXX
cpanel IN XX.XX.XXX.XXX
whm IN A XX.XX.XXX.XXX
webmail IN A XX.XX.XXX.XXX
webdisk IN A XX.XX.XXX.XXX
2. Put [...]
How to redirect the main domain to a sub-domain
To redirect a domain to its own sub-folder,
use the following code in your .htaccess file :
RewriteEngine On
RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^present site.com/$ [NC,OR]
RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^www.present site.com/$ [NC]
RewriteRule ^(.*)$ http://www.present site.com/sub-folder/$1 [r=301,nc]
Add-on Domain being redirected
Issue :
While accessing the subfolder of an addon domain using
httpd://www.addondomain.com/subfolder
the URL changes to
httpd://www.subdomain.maindomain.com/subfolder
but at the same time,
httpd://www.addondomain.com/subfolder/ (the one with trailing slash) works fine.
Fix :
This issue can be fixed by changing the ServerName entry in httpd.conf.
Change
ServerName subdomain.maindomain.com
to
ServerName addondomain.com

