how to point different links to the same php script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
khaledvic
Forum Newbie
Posts: 6
Joined: Mon Mar 09, 2009 10:31 am

how to point different links to the same php script

Post by khaledvic »

hey all
I have a problem how to point different links to the same php script like
mysite.com/blog1
mysite.com/blog2
to the same php script exist in mysite.com/blog
not redirect

please
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Re: how to point different links to the same php script

Post by William »

If you're using Apache Google mod_rewrite.
khaledvic
Forum Newbie
Posts: 6
Joined: Mon Mar 09, 2009 10:31 am

Re: how to point different links to the same php script

Post by khaledvic »

but have i to add to .htaccess line for every new domain
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Re: how to point different links to the same php script

Post by William »

khaledvic wrote:but have i to add to .htaccess line for every new domain
If you don't mind me asking, what are you trying to do?

Edit: @php_east Yeah exactly, that's kind of confusing me too.
Last edited by William on Wed Mar 18, 2009 1:24 pm, edited 1 time in total.
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: how to point different links to the same php script

Post by php_east »

khaledvic wrote:but have i to add to .htaccess line for every new domain
theres only one domain in your example.
khaledvic
Forum Newbie
Posts: 6
Joined: Mon Mar 09, 2009 10:31 am

Re: how to point different links to the same php script

Post by khaledvic »

ok
but if i need an automatic script which makes subdomains ??
like :
site1.mysite.com
site2.mysite.com
....
to mysite.com/blog.
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Re: how to point different links to the same php script

Post by William »

khaledvic wrote:ok
but if i need an automatic script which makes subdomains ??
like :
site1.mysite.com
site2.mysite.com
....
to mysite.com/blog.
So you went from wanting mysite.com/blah1 mysite.com/blah2 to custom subdomains?
khaledvic
Forum Newbie
Posts: 6
Joined: Mon Mar 09, 2009 10:31 am

Re: how to point different links to the same php script

Post by khaledvic »

yeah or the first but i prefer the second
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Re: how to point different links to the same php script

Post by William »

khaledvic wrote:yeah or the first but i prefer the second
If you're wanting "specific' folders/sub domains set to go to that script then you're going to need to add them manually. If you want ALL subdomains or ALL folders to point to that script that's a different story. Which one is it?
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: how to point different links to the same php script

Post by php_east »

same thing, what william said applies.
it is actually a redirect that you want, only that you have a choice of mod rewrite or a php redirect, mod-rewrite will probably be the right normal way, but under certain cicumstances, you may prefer php redirect. it all depends on what you are trying to achieve and how you want it done.

easiest way is perhap to send everthing into your main script for processing with mod_rewrite and onward distribution. i'd be interested in what william or others opinion would be.
khaledvic
Forum Newbie
Posts: 6
Joined: Mon Mar 09, 2009 10:31 am

Re: how to point different links to the same php script

Post by khaledvic »

ok i will point all sub domains to that script
khaledvic
Forum Newbie
Posts: 6
Joined: Mon Mar 09, 2009 10:31 am

Re: how to point different links to the same php script

Post by khaledvic »

???????????????????????????????????????????????????
up
Post Reply