Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How can we redirect and rewrite URLs with an .htaccess file

edited October 2017 in server

Follow below procedure to redirect any URL to another URL :-
1> Creating an .htaccess, IF already present .htaccess file than skip it.
2> Add code for Redirecting a URL in file
If currently you are using homepage.html as your index file and then later rename homepage.html to main.html, you could set up a redirect to send users from homepage.html to main.html.
For example:

RewriteEngine On
Redirect /homepage.html http://www.example.com/main.html

You can also redirect for 404 error. Instead of showing a 404 page, this redirection take to the homepage of the website.

ErrorDocument 404 http://example.com/

Sign In or Register to comment.