Jump to content

SubDomain + file help (PHP & MySQL / htaccess)


Jakehh

Recommended Posts

Hello,

 

I am currently hand-coding a website by myself, it requires the user to set a town and state, and with those i wish to do the following,

state.site.com/town/, and i do not wish to consume space by making multiple folders. is there a quick and easy to maintain way?

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/183692-subdomain-file-help-php-mysql-htaccess/
Share on other sites

You'll need to be a little more specific with regards to "would become".

 

What address do you wish the user to type into the Address bar?

What is the address of the page you wish them to see?

Do you wish the forward to show the 'actual' link in the Address bar, or the address they typed still?

I don't see what's so hard to explain? All I asked was where the file is stored that you wish the user to see and where you want them to think they're are actually looking at (the link in the address bar). It makes a big difference to the pattern used. If you wish the address bar to contain http://domain.com/state/town but the user to actually view http://california.some-town.domain.com then the mod_rewrite could be something as simple as...

 

RewriteRule ^([a-z]+)/([a-z]+)/?$ http://$1.$2.google.com

 

But if you want the opposite (which it sounds like you do) then it's a bit more complicated and requires your DNS supporting it. This link seems a fairly comprehensive yet simplified resource.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.