Rewrite Rule
Sites

Rewrite Rule

  • 2023-01-22 12:03:54

Redirects

FlashVPS allows you to configure redirects that can be configured to automatically redirect visitors from one page to another. These redirect rules can be created via the 'New Rewrite Rule' tab at the site's nginx configuration management interface.

Create a redirect rule

Redirects are wrappers around Nginx's rewrite rules and can use the full redirection syntax supported by Nginx, including regular expressions. For example, you can use = /to match only the root of the domain.

Steps to create a Redirect Rule:

  1. At the tab Cấu hình Nginx> SelectNew Rewrite Rule Rewrite Rule 0
  2. Enter information about the redirect rule
  • Memo : Reminder name for the rule
  • Type : Temporary Redirect | Permanent Redirect | lastRewrite Rule 1
  1. SelectNew Rewrite Rule

⚠ INFO: Update Nginx Config.
After adding, deleting, and editing Nginx Config, you need to click the "Update Nginx Configuration" button for the changes to take effect.

Fix redirect rule

You can edit your Redirection Rules via a tab Cấu hình Nginxon your site management dashboard in FlashVPS. Steps to fix the redirect rule:

  1. At tab Cấu hình Nginx> Select tabServer Rewrite Rule 2
  2. Find the redirect rule you want to edit > select the pen icon

* Note : Edit redirect rules and MemoRewrite Rule 3 only 3. SelectEdit Nginx Configuration

⚠ INFO: Update Nginx Config.
After adding, deleting, and editing Nginx Config, you need to click the "Update Nginx Configuration" button for the changes to take effect.

Temporary Redirects and Permanent Redirects

FlashVPS supports 2 types of redirects:

  • Permanent Redirect (HTTP Status Code 301)
  • Temporary Redirect (HTTP Status Code 302)

While both of these types of redirects are generally invisible to the user, browsers handle them differently, and it's important to know the difference.

Temporary redirect

When the browser encounters a temporary redirect, it takes you to your destination and forgets that it was redirected from the original page. If you change the landing page and then visit the original page again, the browser will see the new redirect location and take you there.

Permanent redirection

With a permanent redirect, the browser will remember that it was redirected from the original page. To save making another network request, the next time the browser visits the original page, it will see that it has been redirected and immediately visit that page instead.

While you can change the destination of the permanent redirect, you'll need to clear your browser's cache before visiting the original page again. Changing the redirect permanently is considered a bad practice, so be careful when doing it.

Redirect Last

The last redirect will make sure to stop looking for the rewrite at the current location, or block and use the changed URI (e.g. a rewritten URI) and search the new location for any matching rewrites.

Author FlashVPS Admin
FlashVPS Admin
Joined in 3 years ago