visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: PHP :: How to have only the domain name in the url?


By: stephaneeybert U.S.A.  Date: 12/02/2003 00:00:00  English  Points: 50 Status: Answered
Quality : Excellent
Hello!


I have my web site with many pages scattered in sub directories.

I end up with urls like

<A HREF="http://www.domainname.com/pages/company/contact.php">http://www.domainname.com/pages/company/contact.php</a>

The full url is displayed in the url zone of the browser.

I would like to see in the browser only the domain name, that is: <A HREF="http://www.domainname.com">http://www.domainname.com</a> and this for all pages.

Of course I want to keep them in their respective directories.

Any strategy?


Thanks
Stephane

By: TheFalklands Date: 12/02/2003 03:32:00 English  Type : Comment
Sure, that's easy. What you do is just setup 2 horizontal frames. Have the top frame be of size 0 and the bottom frame be of size 100%. Have this frameset be your index.html file in your webroot. Then load all pages into the bottom frame and your url will always appear <A HREF="http://www.yourdomain.com">www.yourdomain.com</a> throughout your site. I don't remember the exact HTML syntax for this...I'd have to look it up. Let me know if you need help with that part. Frames are pretty easy, so it shouldn't be too difficult for ya. :)
By: VGR Date: 12/02/2003 04:12:00 English  Type : Answer
yes. Something like this

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<meta name="generator" content="Wordpad">

<meta http-referer="<A HREF="http://your">http://your</a> domain">
<META NAME="description" content="your descr">
<META NAME="keywords" content="your keywords">
<META NAME="host-admin" content="contact@your domain">
<META NAME="author" content="webmaster@your domain">
<META NAME="document" content="index.php">
<META NAME="creation" content="16/09/2002">
<META NAME="last-modified" content="23/10/2002">
<META NAME="root" content="<A HREF="http://your">http://your</a> domain">

<title>your title</title>
</head>
<frameset rows="*, 0" frameborder=0 border=0 framespacing=0>
<frame name=a src="<A HREF="http://here_the_real_url/ugly/">http://here_the_real_url/ugly/</a>">
<frame name=b scrolling=no noresize src="<A HREF="http://www.on101.co.uk/blank.html">http://www.on101.co.uk/blank.html</a>">
</frameset>
</HTML>

By: RQuadling Date: 12/02/2003 04:21:00 English  Type : Comment
You can even use 1 frame!
By: sumotimor Date: 13/02/2003 07:06:00 English  Type : Comment
Another way.
in index.php use include("pages/company/contact.php");
and in all other pages add at first line
if (!eregi("index.php", $PHP_SELF)) { die (""); }
But in this case you have to change whole project to support all you files, like PHP Nuke do it with modules.

By: stephaneeybert Date: 13/02/2003 07:18:00 English  Type : Comment
Thanks for your comments! I will try your code VGR. Maybe with one frame like RQualing suggested. Sumotimor your suggestion is interesting also but I don't really get it as I don't know PHP Nuke.


By: sumotimor Date: 13/02/2003 23:41:00 English  Type : Comment
Here is a short explaint (not about PHP Nuke).
You have only one index.php and a lot other modules.
if index.php you will do something like this:
switch ($mod) {
case "news":
include("news/news.php");
break;
case "forum":
include("forum/index.php");
break;
default:
include ("modules/default.php");
}
----------
So you will always have URL like <A HREF="http://www.domain.com/index.php?mod=[name">www.domain.com/index.php?mod=[name</a> of the mod]. No one will know where is the actual modules are located.
By: stephaneeybert Date: 13/02/2003 23:50:00 English  Type : Comment
Cheers Sumotimor. The only thing is I would try not to hard code any page names in the source code.
By: stephaneeybert Date: 14/02/2003 07:42:00 English  Type : Comment
Thansk to all of you! I went with the code VGR posted. So I decided to give him the points...

Cheers!


Do register to be able to answer

EContact
browser fav
page generated in 303.817990 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page