VDS Sphera Knowledge Base
| Main / Browse Categories / Apache / How can I redirect users trying to access any page on my site to the homepage? |
How can I redirect users trying to access any page on my site to the homepage?
If you want to use the mod_rewrite engine, put the following in an .htaccess file, and edit accordingly:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://www.YOUR_DOMAIN [NC]
RewriteCond %{HTTP_REFERER} !^http://YOUR_DOMAIN [NC]
RewriteCond %{HTTP_REFERER} !^http://YOUR_IP_ADDRESS [NC]
RewriteCond %{HTTP_REFERER} !^http://www.YOUR_DOMAIN:80 [NC]
RewriteCond %{HTTP_REFERER} !^http://YOUR_DOMAIN:80 [NC]
RewriteCond %{HTTP_REFERER} !^http://YOUR_IP:80 [NC]
RewriteRule /* http://YOUR_REDIRECT [R,L]
Additional resources:mod_rewrite - A Beginner's Guide to URL Rewriting mod_rewrite Cheat Sheet - Cheat Sheets - ILoveJackDaniels.com Redirect Webpages to Another Domain URL Rewriting | redirecting URLs with Apache’s mod_rewrite Apache 1.3 URL Rewriting Guide
User Comments
|
||||||||
Attachments
| No attachments. |
Related Articles


