2015-11-19 68 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]