• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
create subdomain with cpanel

#1
[eluser]runrun[/eluser]
Hi, today I went to Cpanel to create a subdomain, http://blog.mysite.com is the subdomain. When I enter the url into the browser, it keeps redirecting me to http://mysite.com/blog. does this have anything to do with codeigniter or my htaccess file?

If you wonder what I put in the htaccess, I do 2 things, remove the index.php. And rewrite links to http://www.mysite.com instead of http://mysite.com

#2
[eluser]toopay[/eluser]
Can you show your working htaccess here? I want to see how its look like...

#3
[eluser]runrun[/eluser]
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    #set the url prelimianrlily with www
    RewriteCond %{HTTP_HOST} !^www.vietnamlist.net$
    RewriteRule ^(.*)$ http://www.vietnamlist.net/$1 [R=301,L]
    
    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    #This last condition enables access to the images and css folders, and the robots.txt file
    #Submitted by Michael Radlmaier (mradlmaier)
    RewriteCond $1 !^(index\.php|images|robots\.txt|css)
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

#4
[eluser]toopay[/eluser]
have you try to exclude 'blog' folder within your htaccess?
Code:
# RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteCond $1 !^(index\.php|blog|images|robots\.txt|css)

#5
[eluser]runrun[/eluser]
I remove the entire code in htaccess, now subdomain behave normally.

But I need a rule to automatically add www to the address, so I added

Code:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI}\\/%{HTTP_HOST}/www. ^/+(.+/)?[^.]*[^/]\\(/)([^w][^w][^w][^.].*/(www\.)¦.*)$ [OR,NC]
RewriteCond %{HTTP_HOST}/www. ^(/)?(/)?([^w][^w][^w][^.].*/(www\.))$ [NC]
RewriteRule ^ http://%4%{HTTP_HOST}%{REQUEST_URI}%2 [L,R=301]

it works, but when I added rule to remove index.php, the site behave weirdly, it has no css, below is the problem code

Code:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_URI}\\/%{HTTP_HOST}/www. ^/+(.+/)?[^.]*[^/]\\(/)([^w][^w][^w][^.].*/(www\.)¦.*)$ [OR,NC]
RewriteCond %{HTTP_HOST}/www. ^(/)?(/)?([^w][^w][^w][^.].*/(www\.))$ [NC]
RewriteRule ^ http://%4%{HTTP_HOST}%{REQUEST_URI}%2 [L,R=301]

RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

#6
[eluser]toopay[/eluser]
should add this line
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#7
[eluser]runrun[/eluser]
great!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.