本文介绍了如何改变URL结构301 code Q2A的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在搜索引擎的重复内容的问题。

我可以用这两个网址的!访问页面Q2A网站

http://www.domain.com/index.php? QA = 1306&放大器; qa_1 =标题

http://www.domain.com/1306/title

我想重定向第一个第二个1如何通过CA怎么办呢?

我试过codeS在这些页面和其他的东西太多,但他们都不工作:(

htaccess改变的index.php?毫秒=用户/用户

我目前htaccess是:

 的DirectoryIndex index.php文件
< IfModule mod_rewrite.c>
RewriteEngine叙述上
#RewriteBase /
的RewriteCond%{REQUEST_URI} ^(。*)//(。*)$
重写规则。 %1 /%2 [R = 301,L]
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
。重写规则^ * $的index.php QA重写= $ 0安培;%{QUERY_STRING} [L]
#重定向非www到www:
的RewriteCond%{HTTP_HOST}!^ WWW \。 [NC]
(。*)重写规则^ $ HTTP://www.% {HTTP_HOST} / $ 1 [R = 301,L]
重定向301 /数学/ http://math.domain.com/

< / IfModule>
 

解决方案

我使用了这些,似乎做工精细:

 的DirectoryIndex index.php文件
< IfModule mod_rewrite.c>
RewriteEngine叙述上
#RewriteBase /
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^用户/?$ /index.php?qa=users [R = 301,L]
重写规则^标签/?$ /index.php?qa=tags [R = 301,L]
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{REQUEST_URI}!^ / QA-主题/.*
的RewriteCond%{REQUEST_URI}!^ / QA-内容/.*
的RewriteCond%{REQUEST_URI}!^ /分析/.*
的RewriteCond%{REQUEST_URI}!^ / QA-插件/.*
的RewriteCond%{REQUEST_URI}!^ / help_files /.*
重写规则^(。*)/(。*)/ $ /index.php?qa=$1&qa_1=$2 [R = 301,L]
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{REQUEST_URI}!^ / QA-主题/.*
的RewriteCond%{REQUEST_URI}!^ / QA-内容/.*
的RewriteCond%{REQUEST_URI}!^ /分析/.*
的RewriteCond%{REQUEST_URI}!^ / QA-插件/.*
的RewriteCond%{REQUEST_URI}!^ / help_files /.*
重写规则^(。*)/(。*)/(。*)/?$ /index.php?qa=$1&qa_1=$2&qa_2=$3 [R = 301,L]
#重定向非www到www:
的RewriteCond%{HTTP_HOST}!^ WWW \。 [NC]
(。*)重写规则^ $ HTTP://www.% {HTTP_HOST} / $ 1 [R = 301,L]
重定向301 /数学/ http://math.domain.com/

< / IfModule>
 

I have a problem with duplicate contents in search engine .

I can access a page in q2a web site using both of these url's !

http://www.domain.com/index.php?qa=1306&qa_1=title

http://www.domain.com/1306/title

I want to redirect the first one to second 1 how ca I do it ?

I tried codes in these page and other things too but none of them works :(

htaccess for changing index.php?ms=user to /user

my current htaccess is :

DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
# Redirect non-www to www:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Redirect 301 /math/ http://math.domain.com/

</IfModule>
解决方案

I used these and It seems work fine :

DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^users/?$ /index.php?qa=users [R=301,L]
RewriteRule ^tags/?$ /index.php?qa=tags [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/qa-theme/.*
RewriteCond %{REQUEST_URI} !^/qa-content/.*
RewriteCond %{REQUEST_URI} !^/analytic/.*
RewriteCond %{REQUEST_URI} !^/qa-plugin/.*
RewriteCond %{REQUEST_URI} !^/help_files/.*
RewriteRule ^(.*)/(.*)/?$ /index.php?qa=$1&qa_1=$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/qa-theme/.*
RewriteCond %{REQUEST_URI} !^/qa-content/.*
RewriteCond %{REQUEST_URI} !^/analytic/.*
RewriteCond %{REQUEST_URI} !^/qa-plugin/.*
RewriteCond %{REQUEST_URI} !^/help_files/.*
RewriteRule ^(.*)/(.*)/(.*)/?$ /index.php?qa=$1&qa_1=$2&qa_2=$3 [R=301,L]
# Redirect non-www to www:
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Redirect 301 /math/ http://math.domain.com/

</IfModule>

这篇关于如何改变URL结构301 code Q2A的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 18:31