Jump to content

Help with mod_rewrite and htaccess in CodeIgniter


cnl2860

Recommended Posts

Hello you freaks :D

 

I'm all new in this forum.

 

Right now i'm working on a webshop project in codeigniter.

In the end there will be multiple webshops on subdomains, and a frontpage on the main domain.

 

It's surposed to be all dynamic so that the webshops get there own subdomains.

The shop information is in the database. Lets say i got a mysql table which contains info like this:

 

webshop: Bobs shop

webshop_subdomain: bobsshop

 

And so on.

 

And now in a .htaccess file i want to make a rewrite rule so that bobsshop.mydomain.com will be rewritten to mydomain.com/bobsshop/ since i'm working in codeigniter with controllers.

You should bear in mind that the index.php also have to be rewrited out.

And there should also be the possibility to make subpages like bobsshop.mydomain.com/contact/

I will make a php script which will check if the subdomain exists in the database and if it doesn't exists in the database the visitor will se a 404.

 

My DNS setup looks like this ATM:

 

mydomain.com xxx.xxx.xxx.xxx

*.mydomain.com xxx.xxx.xxx.xxx

Where xxx.xxx.xxx.xxx is my server IP.

 

I've really never worked with htaccess / mod_rewrite before.

Can it be done? And are there anyone who can help me make this?

 

And sorry for my english. I'm from denmark.

Hope you understand what i'm trying to do.

 

Best Regards

Christian

 

Thanks in advance

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.