问题与子域和htaccess的搜索引擎优化 [英] Issue with subdomains and htaccess for SEO

查看:150
本文介绍了问题与子域和htaccess的搜索引擎优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从改变网址:
http://subdomain.domain.com/page/ http://subdomain.domain.com/?page=pagename
也:
http://domain.com/page/ http://domain.com/?page=pagename < BR> 虽然还没有取得多大成功。

I would like to change urls from:
http://subdomain.domain.com/page/ to http://subdomain.domain.com/?page=pagename
and also:
http://domain.com/page/ to http://domain.com/?page=pagename
though haven't had much success.

这是我的htaccess的文件至今[更新]

Options +FollowSymlinks -MultiViews

RewriteEngine On
RewriteBase /

# Remove 'www'
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

# Add slashes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !index.php
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://resolutiongaming.com/$1/ [L,R=301]

# Subdomain redirect
RewriteRule ^/(webdev)/(.*)$ http://webdev.resolutiongaming.com/$1 [R=301,L]
RewriteRule ^/(artwork)/(.*)$ http://artwork.resolutiongaming.com/$1 [R=301,L]
RewriteRule ^/(music)/(.*)$ http://music.resolutiongaming.com/$1 [R=301,L]

# Search engine optimization
RewriteRule ([a-zA-Z]+)/$ ?page=$1

我用重写规则^([A-ZA-Z] +)/ $?页= $ 1 这似乎工作,为域名网址而不是子域。任何帮助将是AP preciated。

I used RewriteRule ^([a-zA-Z]+)/$ ?page=$1 which seemed to work for the domain url but not the subdomain. Any help would be appreciated.

推荐答案

所以这是一个简单的办法真的。我基本上把.htaccess文件中看起来像这样每个子目录:

So it was an easy fix really. I basically put a .htaccess file in each subdomain directory that looks like this:

Options +FollowSymlinks -MultiViews

RewriteEngine On
RewriteBase /

# Search engine optimization
RewriteRule ([a-zA-Z]+)/$ ?page=$1

希望这可以帮助别人。 :D

Hope this helps someone. :D

这篇关于问题与子域和htaccess的搜索引擎优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆