Managing Dynamic Content using Rewrite in .htaccess file

Hi,

I have a website where I'll be creating a dynamic page for each country once I have enough info about it. So I wouldn't start off with all countries I'm using RewriteRule in .htaccess since it's a dynamic content which pulling data from MySQL database. The pages like :

www.mywebsite.com/us/
www.mywebsite.com/uk/
etc..
and in the htaccess I do something like this : RewriteRule   us/$ content.php?id=us
Now, my problem is, I have to create a new line in my htaccess for each country I decide to put its page up So it would give an 404 error for any country I'm not ready to publish the content of it yet.
Is this the best way to handle this situation or do you have any other suggestions? Since right now I might have 15 countries ready but I'll be heading to over 165 countries later and I'll have to do it separately for each one.

Thank you so much in advance for helping me out here.
Dido123Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mattibuttCommented:
You don't create new line you provide once so everytime country changes based on the parameter it also depends how you are getting the country name on the page is it coming from database
Dido123Author Commented:
I send the required data (including the country name) using POST in the url like this :

RewriteRule   us/$ content.php?id=us&name=United+States&nationality=American&continent=North+America

I know that I can pull the other info using MySQL but I do it that way since I need to send country id anyway.
Ray PaseurCommented:
I think all you want to send is the minimum amount of information to identify the country.  That would be the country code.  Your page initiation script can look up the other parts from your data base.

RewriteRule   us/$ content.php?id=us

However you might want to consider using a subdomain design pattern like the major successful sites use.  In the case of the German version of Wikipedia...
http://de.wikipedia.org/wiki/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Shinesh PremrajanEngineering ManagerCommented:
The best option to write a PHP script that will generate the .htaccess [or a text file that you can rename it to .htacess] file as the requirement is dynamic. The script can handle this elegently.

Hope this helps
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.