2015-11-19 70 views
2

我有一个问题 - SEO - PHP。(SEO + htaccess)页面列表与分页和页面详细

我有2页:新闻列表页面和新闻详细页面。

但是,在SEO的观点上,我该如何区分URL中的这两个页面?

目前,我正在使用这些网址:

  • www.site.com/it/news/page-1/ - www.site.com/it/news/page-2/ ... (用分页消息列表)
  • www.site.com/it/news/title-news-detail/ (新闻内容)

我的文件的.htaccess代码:

# first parameter 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]+)/$ index.php?lang=$1 [L] 
# 

# second parameter 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]+)/([^/]+)/$ index.php?lang=$1&page=$2 [L] 
# 

# third parameter 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$ index.php?lang=$1&page=$2&param=$3 [L] 

我的问题是读第三个参数,因为我不知道这是不是页码或新闻标题..

回答

0

有这样的:

# ignore files and directories from all rules below 
RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule^- [L] 

# first parameter 
RewriteRule ^([^/]+)/$ index.php?lang=$1 [L,QSA] 

# second parameter with pagination 
RewriteRule ^([^/]+)/page-(\d+)/$ index.php?lang=$1&page=$2 [L,QSA] 

# second parameter with title 
RewriteRule ^([^/]+)/([^/]+)/$ index.php?lang=$1&title=$2 [L,QSA] 

# third parameter 
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$ index.php?lang=$1&page=$2&param=$3 [L,QSA]