我正在尝试将site.com w.site.com ww.site.com和wwww.site.com重定向到www.site.com.
我的老板想要确保打字错误也可以进入网站.
他们重定向很好.我正在使用ASP.Net并使用正则表达式返回301重定向,但是,当我尝试时,诸如http://www.seoconsultants.com/tools/headers.asp之类的工具似乎没有显示正确的重定向使用w.site.com ww.等等
我想知道谷歌看到了什么,但我不知道在哪里检查.
它会"出现"firebug将其报告为301,但我无法弄清楚为什么这些工具会报告错误的信息.我的老板正在使用网络工具来查看这些是否有效,所以有人知道如何证明301正在被正确发回.或者任何人都可以推荐一种方法,如果返回正确的301,我可以检查自己?
我希望301从www.olddomain.com重定向到newdomain.com的根目录,但无论旧域上的文件夹路径是什么,我都希望它能够正常工作.例如:以下内容应全部重定向到newdomain.com的根目录
www.olddomain.com
olddomain.com
www.olddomain.com/folder/file.php
olddomain.com/folder/file.php
Run Code Online (Sandbox Code Playgroud)
如何在.htaccess文件中使用Mod Rewrite执行此操作?
我想要的是:
301将/file_new.pdf重定向到/ file new.pdf(%20又名文件和新文件之间的空格)
我知道:
但是,我个人很好奇如何做到这一点.这是我到目前为止所拥有的:
Redirect 301 /file_new.pdf http://sitename.com/file\ new.pdf
Run Code Online (Sandbox Code Playgroud)
调用configtest时,conf文件解析器会抛出错误:
重定向需要两个或三个参数,一个可选状态,然后是要重定向的文档和目标URL
编辑:显然mod_rewrite和Redirect 301方法对我有效,可能是因为无论出于什么原因他们没有应用,因为该文件实际存在于该位置.
<VirtualHost *:80>
DocumentRoot /www/sitename_com
ServerName site.local
Options -MultiViews
RewriteEngine on
Redirect 301 /pdf/file_new.pdf http://site.local/pdf/file%20new.pdf
RewriteRule ^/pdf/file_new.pdf http://site.local/pdf/file\ new.pdf
RewriteLog "/www/rewrite.log"
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
在rewrite.log中,它尝试将模式匹配到每个相应的uri/http请求.我认为有些东西在它甚至到达mod_alias/mod_rewrite之前就已经控制了.
总而言之,它直接转到浏览器中的file_new.pdf而不是301.我很肯定alias并且rewrite已启用.我的apache版本是2.2.
所以我有一系列的重定向到一堆我想要重定向到他们的父目录的页面(例如/ faq/question1/ - >/faq /),但是它非常不灵活,因为它们是手动生成的.
如何RewriteRule为此设置RegEx-燃料?我无法弄明白,并且非常喜欢一些指导.这是我的整个.htaccess,以避免任何冲突(你可以看到RewriteRules我现在的个人):
AddDefaultCharset utf-8
AddHandler php5-script .php
DirectoryIndex index.php
ErrorDocument 403 /errors/forbidden.html
ErrorDocument 500 /errors/internalerror.html
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^halftoneproductions.com
RewriteRule (.*) http://www.halftoneproductions.com/$1 [R=301,L]
# FAQ redirects
RewriteRule ^faq/how-much-does-it-cost-to-make-an-albummix-a-songetc /faq/ [R=301,L]
RewriteRule ^faq/im-a-singersongwriter-with-no-band-members-would-you-be-able-to-do-a-full-production-of-my-songs-with-session-musicians /faq/ [R=301,L]
RewriteRule ^faq/do-you-do-postsound-for-film-at-all /faq/ [R=301,L]
RewriteRule ^faq/i-have-a-home-studio-and-just-need-to-record-___-is-that-cool /faq/ [R=301,L]
RewriteRule ^faq/are-you-a-publishing-company /faq/ [R=301,L]
RewriteRule ^faq/do-you-need-any-interns-or-runners /faq/ [R=301,L]
RewriteRule ^faq/can-i-bring-my-own-producerengineer-to-a-session /faq/ [R=301,L]
RewriteRule ^faq/what-types-of-music-do-you-work-on /faq/ [R=301,L]
RewriteRule ^faq/do-you-work-with-languages-other-than-english /faq/ [R=301,L]
RewriteRule ^faq/do-you-guys-make-beats /faq/ [R=301,L]
RewriteRule …Run Code Online (Sandbox Code Playgroud) 我不能在Blogger上使用.htaccess,但我需要尝试保留帖子的搜索排名.
用户可以重定向(使用Javascript),但如果我无法使用正确的301重定向,我如何确保Google不适合并删除帖子的排名?
我有2个顶级域名example.com和example.ie.
example.com而example.ie这两个点在同一IP地址和拉动同样的内容,现在我们可以得到疲惫不堪与谷歌禁令锤重复的内容,所以我们希望任何人访问*.example.ie和*.example.com重定向到www.example.com的问题是,他们都在同一台服务器指向.htaccess是一样的因此我不相信我们可以做通常的事情:
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc]Run Code Online (Sandbox Code Playgroud)
那么,我们如何去创建一个搜索引擎友好的301重定向来自*.example.ie和*.example.com到www.example.com?
.htaccess mod-rewrite redirect url-rewriting http-status-code-301
快速更新
好的到达那里这个mod_alias?
RedirectMatch 301 ^/ http://brightmist.co.uk/
Run Code Online (Sandbox Code Playgroud)
我已经在所有内容中添加了这一行代码,它似乎可以工作,但是我的其他目录如http://brightmist.co.uk/blog/2013/02/23/manchester-art-gallery-feb-2013正在告诉谷歌这些页面暂时移动 - 请参阅http://www.internetofficer.com/seo-tool/redirect-check/
这是否意味着我必须通过我的网站,并添加一个重定向的基调?
原始问题
我有一个新网站.我想将所有旧网站链接从http://artygirl.co.uk重定向到我的新网站http://brightmist.co.uk/
我主要是一名拥有多年使用Photoshop,CSS,HTML,Wordpress和jQuery经验的设计师,但我对编辑htaccess文件等内容并不了解.我不想弄错,因为它意味着谷歌排名下降等
有谁知道我可以粘贴到我的htaccess文件底部的任何脚本,我希望它将网站上的所有链接/页面重定向到以前的相同位置.例如,如果我输入http://artygirl.co.uk/buy-art-prints-cheshire/我想要它去http://brightmist.co.uk/buy-art-prints-cheshire/我是使用相同的主机,他们只是重新指向域
我的主机最近添加了以下代码,我认为这也与域映射有关,这里也是我的整个htaccess文件 -
ErrorDocument 401 /forms/401.html
ErrorDocument 403 /forms/403.html
RewriteEngine On
RewriteBase /
#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteCond %{REQUEST_URI} ^.*/wp-admin$
RewriteRule ^(.+)$ $1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ …Run Code Online (Sandbox Code Playgroud) 我已经看到了几个关于从一个域到另一个域的301重定向的问题.这个问题涉及一些特殊情况.
我有一个网站domain1.com,它指向/ public_html/sitehosting
由于几个原因,我现在还没有进入,我们决定将网站移动到新的域domain2.com,该域也映射到/ public_html/sitehosting
如何创建301重定向,以便将所有domain1.com URL重定向到domain2.com上完全相似的URL?
我们希望这种重定向以保留Google PR果汁... domain1.com有一个非常好的pagerank.当domain1.com在大约6个月后到期时,我们不打算续订.
PS我正在使用带有"seo"永久链接的WordPress.
PPS我理解,因为两个域都映射到同一个文件夹,所以任何domain1.com URL都会导致相同的内容.但PR汁液会以这种方式转移到domain2.com吗?
在将大型静态站点迁移到wordpress(以及重建)之后,我的永久链接结构与原始目录结构不同,但新的帖子与原始文件名相同.还值得一提的是,永久链接结构模仿旧文件路径的文件扩展名.
例如:
什么曾经(静态目录)
www.example.com/old/path/file.htm
Run Code Online (Sandbox Code Playgroud)
现在(wordpress永久链接结构)
www.example.com/new/path/file.htm (note: permalink structure mimics the .htm extension)
Run Code Online (Sandbox Code Playgroud)
我的问题:是否有可以从/path/to/file/(file.htm重定向访问者一个简单的htaccess重写规则)来/new/path/to/(file.htm),而无需创建一个重定向为每个文件?
我认为主题涵盖了它。我需要建立一个在同一域内的许多301重定向的列表,即将/ some_old_place重定向到/ some_new_place。我们有很多内容会根据uri停用或替换。haproxy状态映射的当前主页上的引号可以用于“构建大量重定向表”,但是对于我来说,我可以一眼搞清楚。我正在使用1.5版,这是我当前正在处理的配置行。
redirect location %[map(/opt/local/etc/haproxy/redirect.map), hdr(url)] code 301
Run Code Online (Sandbox Code Playgroud)
鉴于以上配置行,我得到
[ALERT] 099/205518 (27981) : parsing [/opt/local/etc/haproxy/haproxy.cfg:83] : error detected in frontend 'LoadBalancer' while parsing redirect rule : expects 'code', 'prefix', 'location', 'scheme', 'set-cookie', 'clear-cookie', 'drop-query' or 'append-slash' (was 'hdr(url)]').
Run Code Online (Sandbox Code Playgroud)
我已经尝试了许多变体,但没有成功。如果有人知道该怎么做,请告诉我?