N-Bomb(Nerd) Posted September 5, 2009 Share Posted September 5, 2009 How would I take all request to my website (examples: domain.com, www.domain.com, domain.com/qoofer etc.. etc.. ) and redirect them all to a single file? Link to comment https://forums.phpfreaks.com/topic/173245-solved-question/ Share on other sites More sharing options...
steveangelis Posted September 5, 2009 Share Posted September 5, 2009 Use a header or meta redirect? Link to comment https://forums.phpfreaks.com/topic/173245-solved-question/#findComment-913251 Share on other sites More sharing options...
bundyxc Posted September 5, 2009 Share Posted September 5, 2009 Headers are more efficient, and are server-side. <?php header( 'Location: http://www.example.com/otherpage.php' ) ; ?> Link to comment https://forums.phpfreaks.com/topic/173245-solved-question/#findComment-913268 Share on other sites More sharing options...
N-Bomb(Nerd) Posted September 5, 2009 Author Share Posted September 5, 2009 Yes, however I don't know what directory or page they're visiting on my website.. how could I possibly add that php code into a page that doesn't exist? Link to comment https://forums.phpfreaks.com/topic/173245-solved-question/#findComment-913273 Share on other sites More sharing options...
corbin Posted September 5, 2009 Share Posted September 5, 2009 You could use htaccess. RewriteCond %{REQUEST_URI} !^file.php$ RewriteRule .* /file.php Link to comment https://forums.phpfreaks.com/topic/173245-solved-question/#findComment-913286 Share on other sites More sharing options...
bundyxc Posted September 5, 2009 Share Posted September 5, 2009 From my understanding, mod_rewrite would work too, although mod_rewrite sounds like it could be more complicated. OR Put the redirect code in your 404 page. Link to comment https://forums.phpfreaks.com/topic/173245-solved-question/#findComment-913294 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.