Open/Close Menu WordPress & WooCommerce Plugin & Theme Development

An htaccess file is a simple text file that you can create using a text editor like NotePad. htaccess allows simple management of web server configurations.

There are different ways of redirecting pages, through HTTP, JavaScript or any of the server-side languages. You can do also it through htaccess, which is probably the most effective and the easiest way.

htaccess uses redirect to look for any request for a specific page and if it finds that request, it forwards it to a new page you have specified:

Redirect /oldpath/oldfile.html

Note that there are 3 parts to that, which should all be on one line :

The Redirect command (or Redirect 301), the location of the file/directory you want redirected relative to the root of your site (/oldpath/oldfile.html = and the full URL of the location you want that request sent to.

Each of the 3 is separated by a single space, but all on one line. You can also redirect an entire directory by simple using:

Redirect /oldpath

Using this method, you can redirect any number of pages no matter what you do to your directory structure. It is the fastest method.

More examples:

Redirect individual pages:

Redirect 301 /oldpage.html

This code will send visitors accessing “oldpage.html” to “newpage.html” instead.

Redirect all files in a directory:

Redirect 301 /mydir

This code will direct visitors accessing any file in the directory, “mydir”, to

Redirect whole site:

Redirect 301 /

This code will direct all visitors to any page on your current website to

© 2017 CodeNegar | Made with love.
Follow us: