English 中文(简体)
mod_rewrite `直接'如何?
原标题:mod_rewrite `Redirect` how?

我有2个座标:thinkingmonkey.methinkingmonkey.com。 双方都有72.0.1(A.K.A局)。

我想将任何要求转至<代码>thinkingmonkey.com至thinkingmonkey.me

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /mysite
    ServerName thinkingmonkey.me
    ServerAlias www.thinkingmonkey.me
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
    Options -Indexes +FollowSymLinks
    RewriteEngine On
</VirtualHost>


<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName thinkingmonkey.com

    Redirect thinkingmonkey.com  http://thinkingmonkey.me/

  #  Redirect / http://thinkingmonkey.me/ #have even tried this

    ServerAlias www.thinkingmonkey.com
    RewriteEngine on
</VirtualHost>

当我试图查阅<代码>thinkingmonkey.com时。 url没有改用thinkingmonkey.me。 纸面地址的斜体为thinkingmonkey.com

我做了什么错误?

最佳回答

mo泥被认为更好、更强大,能够处理这些rew泥。 您可使用以下法典:

Options +FollowSymLinks -MultiViews
RewriteEngine on

RewriteCond %{HTTP_HOST} ^(.*.)?thinkingmonkey.com$ [NC]
RewriteRule ^ http://%1thinkingmonkey.me%{REQUEST_URI} [L,R=301]

如果你真心想要使用 mo式_子,你可以在<条码>上把这一条放在<条码>上。

Redirect 301 / http://thinkingmonkey.me/
问题回答

Try this:

RewriteEngine On
RewriteCond %{HTTP_HOST} !.*thinkingmonkey.me$
RewriteRule ^/(.*)$ http://thinkingmonkey.me/$1 [R]

文件:rel=“nofollow”http://http://d.apache.org/docs/2.2/mod/mod_rewrite.html





相关问题
URL rewrite in IIS6 - Third party tools

I have collected the following api/sdk/whatever which provide modules for doing url rewriting in IIS 5/6/7. Some are free-open source and some require $. I haven t tried any of them. I would like to ...

Rewrite spring-security redirect URLs

I m trying to get Tuckey UrlRewriteFilter to tidy up URLs for my webapp. One problem I ve got is that when spring-security notices that an anonymous user is trying to access a protected resource it ...

ASP.NET Friendly URLs

In my research, I found 2 ways to do them. Both required modifications to the Application_BeginRequest procedure in the Global.Asax, where you would run your code to do the actual URL mapping (mine ...

Could I get by HttpModule the URL that contains * before?

My web-site is working under ASP.NET 3.5, IIS7, Integrated pipiline mode. My HttpModule is getting request to all resources, including URLs like this: http://my-site.com/address And I would support *...

Domains & Foreward Slash

This is rather difficult to explain so please bear with me. We will be hosting 4 websites on our server and the plan is to have each site sit under its own domain: site-a.com site-b.com sub1.site-b....

URL Mod-Rewrite

I currently have a working URL: http://example.com/security-services.php?service=fixed-camera-surveillance and then I have PHP say, $_REQUEST[ service ] to do some stuff... But I d like to ...

热门标签