How to redirect URLs to different Web sites

本文介绍如何在Microsoft IIS中设置URL重定向和重写规则,包括使用IIS进行文件夹重定向的方法及利用通配符和替换变量进行URL重写的步骤。

http://support.microsoft.com/kb/324000

This article describes how to translate redirection and rewriting configurations from an Apache configuration file to Internet Information Services (IIS).

Redirecting URLs

loadTOCNode(2, 'summary'); When you use Apache, you can redirect URLs by using the Redirect directive to point a folder or a location to a different folder on either the same Web site or a different Web site. You can also alias a folder to another location by using the Alias directive. If you use IIS, you can perform the same tasks by using the URL Redirection functionality.

To redirect a folder or file IIS:

  1. Log on to the Web server computer as an administrator.
  2. Click Start , point to Settings , and then click Control Panel .
  3. Double-click Administrative Tools , and then double click Internet Services Manager .
  4. Right-click the Web site or the folder, and then click Open .
  5. Right-click the folder display, point to New , and then click Folder .
  6. Return to Internet Services Manager.
  7. Right-click the folder that you just created, and then click Properties .
  8. Click the Directory tab, and then click A redirection to a URL .
  9. To redirect the folder to another URL, click the URL of the folder or the Web site that is described in step 4, and then type the complete URL to the new site in the Redirect to box.
  10. To redirect the folder to another folder within in this folder (for example, Projects to Sections/Departments/Projects), click A directory below this one , and then type the new folder in the Redirect to box.
  11. To mark the redirection type as a permanent redirection (and not a temporary redirection), click A permanent redirection for this resource .

    If you use this setting, bookmarks and other details are automatically updated on some browsers.
  12. Click OK to save the changes.

Rewriting URLs

loadTOCNode(2, 'summary'); If you use Apache, you can use the regular expression system to rewrite or redirect URLs to different folders, files, or directories. If you are using IIS, you can perform the same task by using a combination of wildcard characters and replacement variables. See the following table to determine the elements of a URL that you can substitute during a rewriting procedure.

Collapse this table Expand this table
VariableDescriptionExample
$SPasses the last matched
element from a URL.
If /scripts is redirected to /newscripts and
the original request is for /scripts/program.exe,
/program.exe is the suffix. The server
automatically performs this suffix substitution.
You use the $S variable
only in combination with other variables.
$PPasses the parameters
in the original URL.
For example, if the original URL is
/scripts/myscript.asp?number=1,
the string "number=1"
is mapped into the destination URL.
$QUsed like $P, but includes
a leading question mark.
For example, if the original URL is
/scripts/myscript.asp?number=1,
the string "?number=1"
is mapped into the destination URL.
$VPasses the requested URL,
without the server name.
For example, if the original URL is
//myserver/scripts/myscript.asp,
the string "/scripts/myscript.asp"
is mapped into the destination URL.
$0
through
$9
Passes the portion
of the requested URL that
matches the indicated wildcard character.
!Do not redirect.Use this variable to prevent redirecting a
subfolder or an individual file in a
virtual directory that has been redirected.


IIS supports the following wildcard characters:

  • Asterisk (*): The wildcard character for any character
  • Question mark (?): The wildcard character for a single character.

You use the redirection functionality described earlier in this article to activate the rewriting. Make sure that the Redirect to box contains the source and the destination URL, separated by a semicolon (;).

For example, to redirect all the files that end with .html to the Default.html file:

  1. Right-click the folder that you want to use as the base for rewriting, and then click Properties .
  2. Click the Directory tab.
  3. Click A redirection to a URL .
  4. Click the exact URL of the folder that is described in step 1.
  5. Type *.html;default.html in the Redirect to box.
  6. Click OK to accept the changes.

To redirect the query for a script to a different script, for example, to redirect myscript.asp?number=1 to newscript.asp?number=1:

  1. Right-click on the original script, and then click Properties .
  2. Click the File tab.
  3. Click A redirection to a URL .
  4. Click the exact URL of the script that is described in step 1.
  5. Type newscript.asp$Q in the Redirect to box.
  6. Click OK to accept the changes.
MATLAB主动噪声和振动控制算法——对较大的次级路径变化具有鲁棒性内容概要:本文主要介绍了一种在MATLAB环境下实现的主动噪声和振动控制算法,该算法针对较大的次级路径变化具有较强的鲁棒性。文中详细阐述了算法的设计原理与实现方法,重点解决了传统控制系统中因次级路径动态变化导致性能下降的问题。通过引入自适应机制和鲁棒控制策略,提升了系统在复杂环境下的稳定性和控制精度,适用于需要高精度噪声与振动抑制的实际工程场景。此外,文档还列举了多个MATLAB仿真实例及相关科研技术服务内容,涵盖信号处理、智能优化、机器学习等多个交叉领域。; 适合人群:具备一定MATLAB编程基础和控制系统理论知识的科研人员及工程技术人员,尤其适合从事噪声与振动控制、信号处理、自动化等相关领域的研究生和工程师。; 使用场景及目标:①应用于汽车、航空航天、精密仪器等对噪声和振动敏感的工业领域;②用于提升现有主动控制系统对参数变化的适应能力;③为相关科研项目提供算法验证与仿真平台支持; 阅读建议:建议读者结合提供的MATLAB代码进行仿真实验,深入理解算法在不同次级路径条件下的响应特性,并可通过调整控制参数进一步探究其鲁棒性边界。同时可参考文档中列出的相关技术案例拓展应用场景。
Python offers multiple frameworks to create web pages. Here are some popular ones and how to use them: ### Flask Flask is a lightweight web framework. First, install Flask using `pip install flask`. Here is a simple example: ```python from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, World!' if __name__ == '__main__': app.run(debug=True) ``` In this code, a basic Flask application is created. The `@app.route('/')` decorator defines the route for the root URL. When a user accesses the root URL of the application, the `hello_world` function is called, and it returns the string `'Hello, World!'`. ### Django Django is a high - level Python web framework. Install it using `pip install django`. To create a new Django project and an app: ```bash django-admin startproject myproject cd myproject python manage.py startapp myapp ``` In `myproject/myproject/urls.py`: ```python from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('', include('myapp.urls')), ] ``` In `myproject/myapp/urls.py`: ```python from django.urls import path from . import views urlpatterns = [ path('', views.index, name='index'), ] ``` In `myproject/myapp/views.py`: ```python from django.http import HttpResponse def index(request): return HttpResponse("Hello, world. You're at the myapp index.") ``` Run the development server with `python manage.py runserver`. ### Bottle Bottle is a fast, simple, and lightweight WSGI micro web - framework. Install it using `pip install bottle`. Here is an example: ```python from bottle import route, run @route('/') def index(): return 'Hello from Bottle!' run(host='localhost', port=8080, debug=True) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值