 |
|
| Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more. |
|
 |

02-12-2012, 07:22 PM
|
|
Contributing Member
Latest Blog: None
|
|
Join Date: 01-22-12
Posts: 110
|
|
|
HTACCESS - Need help in Permanent Redirection Issue
hello gurus,
as part of my learning, i've encountered the subject htaccess.
there is one issue i wanted to ask and clear about, if it's possible to accomplish.
facts:
i have 2 separate domain on the same server.
-country based domain, http://national-site.ph
-regional based domain, http://regional-site.ph
i want to redirect my regional based domain name to a sub-domain of my country based domain.
it's like this,
http://regional-site.ph
shall be redirected to
http://regional-site.national-site.ph
and after redirection, the address bar in the browser shall display
http://regional-site.ph instead of
http://regional-site.national-site.ph
Last edited by HTMLBasicTutor; 02-12-2012 at 08:05 PM.
|

02-12-2012, 08:07 PM
|
 |
Super Moderator
|
|
Join Date: 10-29-07
Location: British Columbia, Canada
Posts: 18,271
|
|
|
Why do you want to do this?
|

02-13-2012, 02:05 AM
|
|
Contributing Member
Latest Blog: None
|
|
Join Date: 01-22-12
Posts: 110
|
|
|
let's just say, its a case scenario. a problem that need a soluton.
so, does this particular problem has a solution?
here are the facts of the problem:
- i've created a website named newyork-classifieds .com
- i've created another website namedusa-classifieds .com
- i want to merged the two website, but maintaining their install status.
- now, i want a regional based site for usa-classifieds.com, and i've created an empty sub-domain.
- both website have users and post listings.
- now, instead of creating a new site inside the sub domain of usa-classifieds.com,
i would want to just redirectnewyork-classifieds.com] to
newyork.usa-classifieds.com
THE purpose of the problem scenario is to simulate a real-life problem, where a classified ads website installation only supports categories but not region or areas.
i hope you got me right. im not a native english speaker. i've tried my best to explain the above.
Last edited by ScriptMan; 02-13-2012 at 05:02 AM.
Reason: links
|

02-13-2012, 05:03 AM
|
 |
Super Moderator
|
|
Join Date: 02-10-07
Location: Central Kentucky
Posts: 10,263
|
|
Why in the world would you want to do something like that?
When all you have to do is include the page using frames or curl.
http://www.php.net/manual/en/curl.examples-basic.php
|

02-13-2012, 06:34 AM
|
|
Contributing Member
Latest Blog: None
|
|
Join Date: 01-22-12
Posts: 110
|
|
|
@ScriptMan
...how am i suppose to do that? may you give examples and tutorials?
it's a case scenerio. a problem to solve.
say for instance, "newyork-classifieds.com" already has traffic.
and i created another website which is a national based/country based website, "usa-classifieds.com"
now... this newly created national based website shall have a regional sub-domain site, that corresponds to all the usa states.
...but i already have one regional based website, which is, "newyork-classifieds.com".
the contents of "newyork-classifieds.com" shall be transferred to
newyork.usa-classifieds.com
since, newyork-classifieds.com already has traffic and popular, i need to preserve the domain name. but, it also needs redirection since, the contents will be transferred to
newyork.usa-classifieds.com
and user shall be redirected to newyork.usa-classifieds.com from newyork-classifieds.com. and the rule shall be, the address that shall appear in the address bar would be, newyork-classifieds.com
i hope you get what i mean. please ask me again if this explanation wasn't clear enough.
|

02-13-2012, 07:25 AM
|
 |
Super Moderator
|
|
Join Date: 02-10-07
Location: Central Kentucky
Posts: 10,263
|
|
I am moving some sites around today so I don't have time to write examples. But here is how it is done using iframes. lexkyweb.com/classifieds.php everything below that gray bar is a framed include from another site.
This is one of the sites I am shifting so it may or may not load two hours from the timestamp of this post.
That code I can share on my next visit after I get some work done.
|

02-13-2012, 07:32 AM
|
|
Contributing Member
Latest Blog: None
|
|
Join Date: 01-22-12
Posts: 110
|
|
|
@ScriptMan
SO, the only remedy for the case problem, is to use iframe? and an htaccess redirection, will bring no solution to the case problem?
if i use the iframe methond, what will be the effect when it comes to the subject of SEO?
|

02-14-2012, 05:47 AM
|
 |
Super Moderator
|
|
Join Date: 02-10-07
Location: Central Kentucky
Posts: 10,263
|
|
|
You are correct about frames. That is why I don't really care for them.
And after playing with curl I don't think it will do the job you want either. It will duplicate the content as text only.
I think your best option is probably to create an RSS feed for each category of the first site and then display that feed in the correct place of the new site. By doing it this way each link contained in that displayed feed would take the viewer to the first site.
RSS can display anything you care to include in the feed. Most sites limit what they put in the feed, but where you own both sites you can do as you please.
You could control whether that was in the same window or in a new one by how you structure the href.
Depending on the server config remote file include might be possible but it is unlikely that you will find that allowed on any shared hosting account and I'm not so sure it is safe, even on a vps or dedicated server.
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 11:50 PM.
Powered by vBulletin Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP
|
|
|