301 redirect help
- Started
- Last post
- 5 Responses
- lumedia
I know nothing about this kind of stuff.
I have a file called index.php that I put in a folder on my server to redirect people to a different page. It contains this code:
<? header( "HTTP/1.1 301 Moved Permanently" ); header( "Status: 301 Moved Permanently" ); header( "Location: http://www.new-url.com/" ); exit(0); ?>
It works just fine on my server, but I am trying to do the same thing for a friend of mine and it doesn't work on their server. Whats up with that? Is it an ISP thing?
Any tips for accomplishing this easily for someone like me? Thanks in advance!
- lumedia0
What, no one here likes the back-end?
- kodap0
use a .htaccess 301 :
create in notepad a file named .htaccess (no txt)
and put this on the first line:
redirect 301 /index.php http://www.domain.com/folder/ind…
- kodap0
this will also help search engine spiders/robots to understand where the page/path is
- neverblink0
1. does your friend have php support?
(you can check this by makeinmg a real simple php file with just echos something (<?php echo "hello world"; ?>))2. could be as simple as your friends server not liking shorthand php-tags:
change
<? [...yourcode...] ?>
into
<?php [...yourcode...] ?>