| |
| |
|
|
|
|
| |
|
| |
|
| :: |
| Author |
Message |
993ti
Joined: 26 Aug 2006 Posts: 16
|
Posted: Wed Oct 04, 2006 1:49 pm Post subject: Redirecting portal.php to domain name with htaccess |
|
|
My site is using a portal and uses this code in htaccess so when going to the domain, it goes to the portal:
| Code: | | DirectoryIndex portal.php index.php index.html |
It doesn't show portal.php in the url so that's good.
I'm not linking to portal.php anywhere since that code already takes care of that and instead every link to the homepage goes to the domain.
But, you can still use domain.com/portal.php.
Recently i checked if portal.php has any PR and it does (PR2).
How can i use htaccess so that PR isn't transferred to portal.php but to my domain (without creating a loop)? |
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14131
|
Posted: Wed Oct 04, 2006 9:03 pm Post subject: Re: Redirecting portal.php to domain name with htaccess |
|
|
Adsense ?
That's one thing to know with AdSense, Google is grabbing URLs from there and that's why for example some end up finding Google trying to load private URLs.
The redirection you're talking about is on the top of my TODO list , it's rather easy to implement it directly in the php files so I never really bother about doing it through .htaccess, but it could en up being a little faster so why not.
Till then, you could put this in your portal.php file :
| Code: | $uri = $_SERVER['REQUEST_URI'];
if (strpos($uri, "portal.php") && !strpos($uri, "?") {
header(Status: 301 Moved Permanently, FALSE, 301);
header("Location: "http://www.example.com/");
} |
The strpos are used for velocity.
Now this code would be better if you add :
| Code: | @session_write_close();
@session_start(); |
before the first header() if you are using php sessions, and, as it could be the case, a little :
| Code: | if ( !empty($db) ) {
$db->sql_close();
} |
right after the php sessions close line if your file is using phpbb sessions
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
|
| Navigation |
Similar Topics |
|
|
|
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| |