Created
October 5, 2014 08:36
-
-
Save souparno/02669dbe1e4ed2137935 to your computer and use it in GitHub Desktop.
.htaccess file ,subdomain and cakePHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onsider a domain www.example.com. You have created an appliaction in its root folder. | |
Now you purchase a new subdomain www.newdomain.net that is like root/newdomain/ in your server. | |
When you place your cake application inside this newdomain folder, you will encounter problem regarding | |
redirect, sometimes you css will be not getting loaded same is with javascript and images. | |
To overcome this problem create 3 .htaccess files in this order:- | |
1) .htaccess file in root/newdomain/ folder write this:- | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteBase / | |
RewriteRule ^$ app/webroot/ [L] | |
RewriteRule (.*) app/webroot/$1 [L] | |
</IfModule> | |
2).htaccess file in root/newdomain/app/ folder write this:- | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteBase / | |
RewriteRule ^$ webroot/ [L] | |
RewriteRule (.*) webroot/$1 [L] | |
</IfModule> | |
3) .htaccess file in root/newdomain/app/webroot/ folder write this:- | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L] | |
</IfModule> | |
save these files and we are done. Your new subdomain www.newdomain.net must now be working fine. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment