Forum Moderators: coopster

Message Too Old, No Replies

301 Redirect...

How is this done using PHP

         

FleaPit

9:12 pm on Aug 6, 2003 (gmt 0)

10+ Year Member



I don't have access to .htaccess so I need to setup a 301 redirect using php. The thing is my current pages use .shtml extensions so will I be able to use a php 301 or am I stumped?

This is the code I have picked up from another thread...

<?php

header("HTTP/1.1 301 Moved Permanently");
header("Location: [widget.com");...]
exit();

?>

It works great with pages using .php but I can't see a way of using it on all my .shtml pages :(

jatar_k

10:05 pm on Aug 6, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you can't

shtml pages are not parsed with php usually, they are parsed by apache SSI. Turning on php parsing as well as SSI causes problems/conflicts/general insanity.

jcoronella

10:10 pm on Aug 6, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have this in my .htaccess:

redirect 301 /widgets.html [mysite.com...]