http://www.rolutionasia.com/index.php?option=com_content&view=frontpage&Itemid=21
正如你看到的,上面的首頁文章鏈接包含組件名和文章ID組成的很複雜、很長的URL。這對搜索引擎來說很不友好。
你有兩個選擇來改變現狀,開起搜索引擎友好鏈接:
1.不開啟Apache的重寫模式:mod_rewrite;開啟搜索引擎友好鏈接(適用於不支持Apache的重寫模式:mod_rewrite 的服務器)
2.Apache的重寫模式:mod_rewrite、搜索引擎友好鏈接都開啟(適用於支持Apache的重寫模式:mod_rewrite 的服務器)
你可以按以下步驟開啟搜索引擎優化設置的功能:
- 以administrator登陸後台
- 選擇前台->全局設置
- 在頁面的左邊你可以看到引擎優化設置(SEO setting);這裡能開啟或關閉Joomla引擎優化設置的功能。
將搜索引擎友好鏈接由否改成是並保存,如下所示:
搜索引擎優化設置
這時網站的URL看起來像這樣:
www.rolutionasia.com/index.php/frontpage
你會發現上面的URL中沒有了組件名和文章ID,取而代之的是index.php/frontpage.
Apache的重寫模式:mod_rewrite、搜索引擎友好鏈接都開啟
大多數主機商都支持mod_rewrite模式。用mod_rewrite來開啟搜索引擎優化是最長用的方法。
你可以按以下步驟來開啟它:
1.用FTP客戶端(或其他方法)登陸到網站空間並進入到安裝 Joomla 1.5的主目錄
2.你現在可以看到一個叫htaccess.txt的文件
3.在你開啟Apache的重寫模式:mod_rewrite功能之前將htaccess.txt 重命名為 .htaccess
4.以administrator登陸後台,選擇前台->全局設置,將搜索引擎優化設置裡的使用Apache的重寫模式:mod_rewrite由否改成是。
保存之後你的URL看起來像這樣:
http://www.rolutionasia.com/website/twitter
你會注意到此時URL裡連index.php的沒有了,剩下的只是簡潔的文章名。
給URL添加html後綴
以administrator登陸後台,選擇前台->全局設置,將搜索引擎優化設置裡的給URL添加後綴由否改成是,並保存。
這時你的URL看起來像這樣
http://www.rolutionasia.com/website/twitter.html
你可以看到在URL的後面多了.html的後綴。
如果以上設定操作無法運行,請在.htaccess檔案裡面加上以下代碼
## Can be commented out if causes errors, see notes above.
Options FollowSymLinks
RewriteEngine On
# Uncomment following line if your webserver’s URL
# is not directly related to physical file paths.
# Update Your Joomla/MamboDirectory (just / for root)
# Uncomment this line
RewriteBase /
#comment all of the lines of the below section
########## Begin Standard SEF Section
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
##RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR]
##optional - see notes##
#RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
#RewriteRule ^(content/|component/) index.php
########## End Standard SEF Section # Uncomment all lines
########## Begin 3rd Party or Core SEF Section
RewriteCond %{REQUEST_URI} ^(/vietnam/component/option,com) [NC,OR]
##optional - see notes##
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php
########## End 3rd Party or Core SEF Section
應該可以成功運行,祝好運Options FollowSymLinks
RewriteEngine On
# Uncomment following line if your webserver’s URL
# is not directly related to physical file paths.
# Update Your Joomla/MamboDirectory (just / for root)
# Uncomment this line
RewriteBase /
#comment all of the lines of the below section
########## Begin Standard SEF Section
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
##RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR]
##optional - see notes##
#RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
#RewriteRule ^(content/|component/) index.php
########## End Standard SEF Section # Uncomment all lines
########## Begin 3rd Party or Core SEF Section
RewriteCond %{REQUEST_URI} ^(/vietnam/component/option,com) [NC,OR]
##optional - see notes##
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php
########## End 3rd Party or Core SEF Section