Announcement

Collapse
No announcement yet.

How To Redirect an Entire Server OR Directory To a Single URL: mod_rewrite

Collapse

Ads on showthread pages

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How To Redirect an Entire Server OR Directory To a Single URL: mod_rewrite

    WordPress Hosting on SSD Servers
    How to redirect an entire server or directory to a single URL: mod_rewrite

    If all you need to do is migrate a server from one name to another, simply use the Redirect directive, as supplied by mod_alias:

    Redirect / http://www.apache.org/

    Since, the redirect will forward along the complete path, it may not be appropriate - for example, when the directory structure has changed after the move, you simply want to direct people to the home page.

    The best option is to use the standard Apache module mod_rewrite. If that module is compiled in, the following lines

    RewriteEngine On
    RewriteRule /.* http://www.apache.org/


    It will send an HTTP 302 Redirect back to the client, no matter what they gave in the original URL, they'll be sent to "http://www.apache.org/".

    Accuwebhosting.com
    Last edited by admin; 07-29-2015, 10:13 AM.
Working...
X
Sign up for a News Letter Click here to sign up