Guest doit4God Posted March 15, 2006 Share Posted March 15, 2006 I was wondering if there is a way to redirect pages. For example, I have the following pages:page1.phppage2.phppage3.phpWhen people typed in or link from other pages to the following:http://www.mydomain.com/page1.php, I want to redirect to mypage.php?id=1http://www.mydomain.com/page2.php, I want to redirect to mypage.php?id=2http://www.mydomain.com/page3.php, I want to redirect to mypage.php?id=3Is this possible? Link to comment Share on other sites More sharing options...
gsmith Posted March 15, 2006 Share Posted March 15, 2006 Will you have some pages where linking to page1.php, etc. will be allowed? Or will all references to page1.php need to be redirected? Link to comment Share on other sites More sharing options...
aspnetguy Posted March 15, 2006 Share Posted March 15, 2006 header("Location: mypage.php?id=1"); Link to comment Share on other sites More sharing options...
gsmith Posted March 15, 2006 Share Posted March 15, 2006 header("Location: mypage.php?id=1");<{POST_SNAPBACK}> That's correct, but if there are some pages where linking to page1.php is ok, there would have to be some kind of conditional test first. Perhaps passing a query string with the "ok" link to test whether or not the page1.php should be displayed or redirected....and if the query string value doesn't exist, then you could redirect. Link to comment Share on other sites More sharing options...
calvin182 Posted March 16, 2006 Share Posted March 16, 2006 or you could accomplish this with .htaccessput this in your .htaccess file: Redirect http://www.site.com/page1.php http://www.site.com/mypage.php?id=1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now