GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   index.html -> index.php 301 redirect question (https://gfy.com/showthread.php?t=947195)

daveylapoo 01-07-2010 09:06 AM

index.html -> index.php 301 redirect question
 
I've got a nice SE placement in yahoo, but they've indexed the www.sitename.com/index.html url, and I am in the process of making the site dynamic so the new homepage url will be www.sitename.com/index.php.

I was wondering how I could do a proper server side redirect using .htacess / 301 redirects as opposed to a meta refresh. I've googled different ways of doing it but none function properly.

Thanks in advance to any who can help out!

ArsewithClass 01-07-2010 09:11 AM

Quote:

Originally Posted by daveylapoo (Post 16723775)
I've got a nice SE placement in yahoo, but they've indexed the www.sitename.com/index.html url, and I am in the process of making the site dynamic so the new homepage url will be www.sitename.com/index.php.

I was wondering how I could do a proper server side redirect using .htacess / 301 redirects as opposed to a meta refresh. I've googled different ways of doing it but none function properly.

Thanks in advance to any who can help out!

Could you not use the index with an enter here to link to a .php page!? I thought that most sites need a landing page thats pretty clean anyway. This way, nothing would change. :Oh crap

fris 01-07-2010 09:13 AM

or you could use modrewrite so you could alias index.html as index.php

i do this for tgp submissions that dont allow .php extensions that my gallery program creates.

so http://www.domain.com/index.php would work as http://www.domain.com/index.html

or in my case

http://www.domain.com/galleries/fuc/...sold/index.php

would work as

http://www.domain.com/galleries/fuc/...old/index.html

Code:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^(/.+\.)html$ [NC]
RewriteCond %{DOCUMENT_ROOT}%1php -f
RewriteRule \.html$ %1php [NC,QSA,L]

hope that helps

daveylapoo 01-07-2010 09:35 AM

Thanks for the responses.

Looks like both of those will work; however, as I understand it the 'proper' way to do this involves the 301 / .htaccess redirect, as it should not affect your SE listings:

http://www.google.com/support/webmas...n&answer=93633

This is the code as it exists in the .htaccess now:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
RewriteRule index\.html index.php [NC,R]

The last line is what should do it, however i think that something preceding this is causing the issue.

Jdoughs 01-07-2010 09:41 AM

A 301 done properly will do exactly what you want. All ranking factors will be passed on accordingly to the 301'd page. (as long as you do it properly, this is not a tactic to rank new pages, only for 'moving' pages).

Google (and yahoo should) will follow the command of the 301 and consider all weight to the "Permanently Moved" url to the new url.

Save yourself some future grief, and never, link to the index.html, OR index.php. and link to the folder/directory. I wouldnt 301 it to the new index.php, I would 301 it to the sitename.com/ directory index. (then it wont matter what kind of index you use today, or in 10 years.


All times are GMT -7. The time now is 01:46 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc