masterbaker Posted December 26, 2006 Share Posted December 26, 2006 I am designing a site for my brother and I want to be able to to redirect certain URLs to make it more user friendly.i.e. if someone types http://www.mysite.com/footy or http://www.mysite.com/news then I want to redirect to http://www.mysite.com/sports/football/index.php and http://www.mysite.com/news/daily/currentheadlines.php. I am stuck on how to do this.Could I somehow redirect the ABC part of the following to a single php page and then deal with the forwarding there (http://www.mysite.com/ABC). I know how to redirect fine its just dealing with the /footy or /newsThanksmaster Quote Link to comment https://forums.phpfreaks.com/topic/31905-solved-getting-info-from-the-addressbar-ie-news-or-footy/ Share on other sites More sharing options...
Shu Posted December 26, 2006 Share Posted December 26, 2006 the easiest way is to set the 404 error page to '/404.php'then in 404.php u could check if the person request that url and then redirect it. Quote Link to comment https://forums.phpfreaks.com/topic/31905-solved-getting-info-from-the-addressbar-ie-news-or-footy/#findComment-148068 Share on other sites More sharing options...
AV1611 Posted December 26, 2006 Share Posted December 26, 2006 there are a zillion ways but I think what you need to do is just make the default doc type for those directories equal to the location with a simply javascript redirect or you could do a php header: Quote Link to comment https://forums.phpfreaks.com/topic/31905-solved-getting-info-from-the-addressbar-ie-news-or-footy/#findComment-148069 Share on other sites More sharing options...
ToonMariner Posted December 26, 2006 Share Posted December 26, 2006 You need to do some url rewriting (mod rewrite) in apache.1st you need to make sure you can - some hosts will not let you.this link will probably the one that will help you most initially.[url=http://www.alistapart.com/articles/succeed/]http://www.alistapart.com/articles/succeed/[/url]This guy has set up his entire site to be run from index.php something I do quite a bit but only recently have I started to use this method for search engine friendly urls - BUT a very good tool if you ask me (makes coding significantly easier too.) Quote Link to comment https://forums.phpfreaks.com/topic/31905-solved-getting-info-from-the-addressbar-ie-news-or-footy/#findComment-148077 Share on other sites More sharing options...
masterbaker Posted December 26, 2006 Author Share Posted December 26, 2006 Thanks a lot for your help. It seems straightforward now Quote Link to comment https://forums.phpfreaks.com/topic/31905-solved-getting-info-from-the-addressbar-ie-news-or-footy/#findComment-148091 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.