ngreenwood6 Posted November 3, 2009 Share Posted November 3, 2009 I would like to redirect all my users to one page on my site. Even for 404 pages. Any ideas on how to do this? Link to comment https://forums.phpfreaks.com/topic/180071-redirect/ Share on other sites More sharing options...
thenewperson Posted November 3, 2009 Share Posted November 3, 2009 new to php but i believe you can redirect it with header("Location: http://yoursite.com"); just use it in a if statement to meet condition you want Link to comment https://forums.phpfreaks.com/topic/180071-redirect/#findComment-949983 Share on other sites More sharing options...
ngreenwood6 Posted November 3, 2009 Author Share Posted November 3, 2009 Not what I am looking for. I want to redirect all pages. I do not want to go into each page and redirect. Link to comment https://forums.phpfreaks.com/topic/180071-redirect/#findComment-949986 Share on other sites More sharing options...
kristofferlc Posted November 3, 2009 Share Posted November 3, 2009 i'm not a master with the .htaccess files coding, but i belive if you add "deny from all" to your .htaccess file, and then make a php page for the 405 error code, also defined by the htaccess file, you can then redirect in the 405 file... So, add this to your htaccess deny from all ErrorDocument 405 http://domain.com/my405.php Then ake the 405 php file redirect... Link to comment https://forums.phpfreaks.com/topic/180071-redirect/#findComment-949988 Share on other sites More sharing options...
Daniel0 Posted November 3, 2009 Share Posted November 3, 2009 Using mod_rewrite: RewriteEngine on RewriteRule .* some_file.php Link to comment https://forums.phpfreaks.com/topic/180071-redirect/#findComment-950025 Share on other sites More sharing options...
ngreenwood6 Posted November 3, 2009 Author Share Posted November 3, 2009 I will try that daniel but do you know if that will still allow me to logout? Link to comment https://forums.phpfreaks.com/topic/180071-redirect/#findComment-950184 Share on other sites More sharing options...
Daniel0 Posted November 3, 2009 Share Posted November 3, 2009 I suppose that depends on how you've coded your website. If you take a look at our main site, we use mod_rewrite more or less like that and last I checked, logging out works fine. Link to comment https://forums.phpfreaks.com/topic/180071-redirect/#findComment-950203 Share on other sites More sharing options...
ngreenwood6 Posted November 3, 2009 Author Share Posted November 3, 2009 ill give it a shot and let you know if I have any issues. Thanks for the help Link to comment https://forums.phpfreaks.com/topic/180071-redirect/#findComment-950365 Share on other sites More sharing options...
ngreenwood6 Posted November 3, 2009 Author Share Posted November 3, 2009 That worked perfectly except for one thing. If I go to a page that doesnt exist it takes me to the 404 page. I tried doing ErrorDocument 404 /index.php but it still takes me there. Any ideas? Link to comment https://forums.phpfreaks.com/topic/180071-redirect/#findComment-950567 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.