CodeIgniter Forums
subdomain failure with CI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: subdomain failure with CI (/thread-20066.html)

Pages: 1 2


subdomain failure with CI - El Forum - 06-26-2009

[eluser]ericsodt[/eluser]
I am working on a website and have created a sub domain 'dev'. I just finished my development effort on my localhost and just brought it up to my host server, and installed it within the subdomain dev.

The problem occurs when I try and submit a form. I can submit to http://www.<mySite>/dev/ but it fails to submit when I try to do http://dev.<mySite> or http://www.dev.<mySite>


Does anyone know how to fix this issue? I am sure it is something small...


subdomain failure with CI - El Forum - 06-26-2009

[eluser]TheFuzzy0ne[/eluser]
Please could you be more specific than "fails to submit"?


subdomain failure with CI - El Forum - 06-26-2009

[eluser]ericsodt[/eluser]
[quote author="TheFuzzy0ne" date="1246070426"]Please could you be more specific than "fails to submit"?[/quote]

I submit the form and it does not go anywhere... It basically refreshes the page. I am not sure if this is because I have error handling that says if a page does not exist then go back to where it was originated from.

Either way, the form submits but does not go to the controller I expect. It does work however when I dont try and use the subdomain in the front of the URL (<mySite>/dev instead of dev.<mySite>


subdomain failure with CI - El Forum - 06-27-2009

[eluser]TheFuzzy0ne[/eluser]
Does the subdomain work when you access it directly from the address bar?


subdomain failure with CI - El Forum - 06-27-2009

[eluser]ericsodt[/eluser]
[quote author="TheFuzzy0ne" date="1246117966"]Does the subdomain work when you access it directly from the address bar?[/quote]

No. You can not type or submit a form to dev.<mySite>.com. You can, however, submit or access the controller by using <mySite>.com/dev.

Can you walk me through the steps of how you, in the past, have created and used a sub domain?

So far, I I've only updated my config file and then created the sub domain through cpanel. Thats it...


subdomain failure with CI - El Forum - 06-27-2009

[eluser]TheFuzzy0ne[/eluser]
I'm not familiar with cPanel. However, if it's a recently added subdomain, it usually takes up to 72 hours to propagate up the DNS chain. If the subdomain has been setup on your hosts DNS, you can usually bypass this by adding an entry to Windows hosts file (C:\Windows\System32\drivers\etc\hosts). I assume you are running Windows?

Each entry needs to be on it's own line:

Code:
dev.yoursite.com 123.468.789.10

Obviously, you need to replace that IP address with the dedicated IP address of your server, which you should have been given by your host. So long as that subdomain exists on your Web hosts DNS, it should resolve immediately.

Hope this helps.


subdomain failure with CI - El Forum - 06-27-2009

[eluser]ericsodt[/eluser]
[quote author="TheFuzzy0ne" date="1246127125"]I'm not familiar with cPanel. However, if it's a recently added subdomain, it usually takes up to 72 hours to propagate up the DNS chain. If the subdomain has been setup on your hosts DNS, you can usually bypass this by adding an entry to Windows hosts file (C:\Windows\System32\drivers\etc\hosts). I assume you are running Windows?

Each entry needs to be on it's own line:

Code:
dev.yoursite.com 123.468.789.10

Obviously, you need to replace that IP address with the dedicated IP address of your server, which you should have been given by your host. So long as that subdomain exists on your Web hosts DNS, it should resolve immediately.

Hope this helps.[/quote]

No, I am not running this... the problem occurs on my hosted domain with is Linux. It also have been over 72 hours since I created this sub domain...

I, too, am out of ideas, thats why I turned to the forums...

Thanks for your help though


subdomain failure with CI - El Forum - 06-27-2009

[eluser]TheFuzzy0ne[/eluser]
I'm a bit confused by your reply. Perhaps I didn't explain correctly. The hosts file I'm referring to is on the PC you are using now, which I assumed was Windows. If it's been more than 72 hours, it's something that might be best taken up with your Web host. If you'd like to PM me the URL for your Web site, I will gladly see if I can get it to work for me.


subdomain failure with CI - El Forum - 06-27-2009

[eluser]ericsodt[/eluser]
[quote author="TheFuzzy0ne" date="1246127475"]I'm a bit confused by your reply. Perhaps I didn't explain correctly. The hosts file I'm referring to is on the PC you are using now, which I assumed was Windows. If it's been more than 72 hours, it's something that might be best taken up with your Web host. If you'd like to PM me the URL for your Web site, I will gladly see if I can get it to work for me.[/quote]

Sure, I can PM you. I'll have to do it later on though as I'm walking out the door. I did figure one thing out. I have to add the 'index.php' to the end of the subdomain name, dev.<mySite>/index.php/profile for example, for it to submit correctly (now the images dont show however.) I do have the mod rewrite in there though, so I thought that should have fixed it. Maybe my mod rewrite needs to be updated for the subdomain too?

.htaccess below
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    #RewriteBase /

    #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]

</IfModule>

Does this look correct? I dont see anything wrong with it...

anyways, I'll PM you the site later on tomorrow (bachelor party tonight). Thanks for your help!!


subdomain failure with CI - El Forum - 06-27-2009

[eluser]TheFuzzy0ne[/eluser]
I'm not so sure about this line:
Code:
RewriteCond %{REQUEST_URI} ^system.*

The line that follows should direct everything to your index.php file anyway, so I can't see it helping at all. You'll no doubt need a line in there to allow you to access css, script and image directories (if you need to).

There may also be a potential problem with the Dollar sign on the last line. I'd suggest removing it, since it's not really necessary. Here is an excerpt from my htaccess file, in case it helps. If you want to know what any of it does, please let me know. I'm not an htaccess expert, but I try to make it a thing to know what's going on in my Web directory.

Code:
<IfModule mod_rewrite.c>
        RewriteEngine On

        RewriteCond %{REQUEST_URI} ^/(system)
        RewriteRule ^(.*) /index.php/$1 [L]

        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        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>

It's essentially a modified version of what can be found on the [url="http://codeigniter.com/wiki/Dreamhost_.htaccess/"]wiki[/url].

This will check if the incoming request is for the system directory. If it is, the request is internally directed to the index.php file.

Next, a check is made to see if the file/directory exists. If it does, it's served up, otherwise it's internally redirected to the index.php.

I've noticed that on my production server, this doesn't work unless I change these lines:
Code:
RewriteRule ^(.*) /index.php/$1 [L]

to this:
Code:
RewriteRule ^(.*) /index.php?/$1 [L] # Note, the question mark.

Hope this helps.