Unstoppable Domains โ€” Expired Auctions

Url question

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

paaaaaaaaaa

Established Member
Impact
6
In directories such as DMOZ how do they get the / on the end of there url like dmoz.com/arts/ how can only think of a why to do it throuh dmoz.php&var=arts
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
edit: nevermind
 
0
•••
I know now it's just linking to the directory which opens the index in that directory

My new problem is I can't direct a php back to the root directory to find a file.
I have ../header.php which isn't working.
 
Last edited:
0
•••
if you explain the problem a little better , i might be able to help out here
 
0
•••
Well I have a header file in my root directory called header.php. I make make all my pages require the header.php file so it adds the header file to every page without coding it everytime.

Now I have had to make a new folder in my root directory. I made a new page in that folder but the require require('header.php'); doesn't work as it's looking in that folder. So how do I tell the server to go back a folder or two or straight back to the root folder?
 
0
•••
fairly simple

PHP:
require_once "../(name of folder header is in)/header.php";

// the rest of your php comes here

that is what you need to put into the php files in the other directory so that they can see where header.php is

Hope that helps

-Steve
 
0
•••
Well I did try that before. But now I just fiqured out that each ../ jumps back a directory so I have ../../header.php and this does the trick.
Thanx

Ah now though. The links that where loaded from my header file are pointing in the wrong dir. Anyway to get that sorted? They need to work also from any directory.
 
Last edited:
0
•••
mess with php

try this and see if you understand (i gotta go to bed soon, its 3am here)
PHP:
<?php
// this is any php document that you are requiring header in
if ($_SERVER["PHP_SELF"] == (some dir)/header.php) {
$text = "../";
} elseif ($_SERVER["PHP_SELF"] == (some dir)/(some dir)/header.php) {
$text = "../../";
}
?>
<a href="<?php echo "$text";?>">link text</a>
and so on and so forth

Hope thats at least a little bit of help for ya

-Steve

does that work for you, because i am about ready to hit the sack, but wanna be helpful as well ;)
 
0
•••
I have to leave now so I'll check it later today. It's 8:30am here. It looks pretty helpfull. Check the thread later. Cheers
 
0
•••
sure, ill be around, i am on namepros every day between work and play B-)

-Steve
 
0
•••
Instead of messing with the PHP you could just make the links relative to the root of the domain, starting it with a slash (/)

Ie. href="/index.php" on http://www.abc.com/folder/file.php goes to abc.com/index.php
 
0
•••
cerebus said:
Instead of messing with the PHP you could just make the links relative to the root of the domain, starting it with a slash (/)

Ie. href="/index.php" on http://www.abc.com/folder/file.php goes to abc.com/index.php
i believe that they already are.

but you are correct in the fact that relative links need to be used. Since PHP can tell a file the location of where it is, you can use PHP to tell execute a certain function depending on where the file has been included.

if that doesnt make sense, sorry. in other words: This method is the way to go

-Steve
 
0
•••
they do it with mod_rewrite

its an apache module that lets you use fake/virtual urls (and then it rewrites them

so you may have a script like
/blah.php?dir=sports&section=f1&page=2

that url is pretty ugly so you can tidy it up and have this
/sports/f1/2


http://www.sitepoint.com/article/guide-url-rewriting/
 
0
•••
Thanx dude. Now that could make things a lot easier. I'll look into it.
 
0
•••
Thanks Adam for this useful tip, I needed it!
 
0
•••
adam_uk said:
they do it with mod_rewrite

its an apache module that lets you use fake/virtual urls (and then it rewrites them

so you may have a script like
/blah.php?dir=sports&section=f1&page=2

that url is pretty ugly so you can tidy it up and have this
/sports/f1/2


http://www.sitepoint.com/article/guide-url-rewriting/
How did I forget to mention the almightly apache module mod_rewrite.

Anyways, some good resources for mod_rewrite follow:
Official mod_rewrite by Apache
A Freelancers Guide to Mod_Rewrite
Mod-Rewrite Generator
^^^I would recommending learning how to do it, not really that hard^^^

Let me know if you need any more help

Best of luck with the site

-Steve
 
0
•••
thanx guys great help there.
 
0
•••
Olitt โ€” high-converting AI websites, only from $1/moOlitt โ€” high-converting AI websites, only from $1/mo
Escrow.com
Spaceship
Domain Recover
CryptoExchange.com
Catchy
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back