Redirecting

Redirecting means forwarding one URL to another URL. Redirects can be configured in different ways, depending on the web server, content management system, or application. The examples below use the Apache modules mod_alias and mod_rewrite and are generally placed in a .htaccess file or server configuration file.

  • The standard format is as follows:

Redirect 301 /old-page https://example.com/new-page

Command | status code | old page | new URL

Redirect | 301 | /old-page | https://example.com/new-page

  • For more complex redirects, the format can look different:

RewriteRule ^old-page/?$ https://example.com/new-page [R=301,L]

Command | old page | new page | flags

  • The syntax for a redirect with parameters can also look different: