Home Backend Development PHP Tutorial Joomla开启SEF的方法_PHP

Joomla开启SEF的方法_PHP

May 28, 2016 am 11:45 AM
joomla

Joomla

本文实例讲述了Joomla开启SEF的方法。分享给大家供大家参考,具体如下:

使用SEF(search engine friendly)网址的主要目的是使内容的关键词出现在URL中,这也是我们常说的SEO中的一项重要内容,对于搜索引擎的来说,这样可以增强当前页面与这些关键词之间的关联度。下面我们来看看如何在Joomla 1.5中使用SEF网址。

1.安装Joomla1.5

2.在全局设置中(Global Configuration),将“搜索引擎优化网址(Search Engine Friendly URLs)”设置为“开启(Yes)”,保存设置。

这是Joomla系统中最主要的搜索引擎优化设置,所以在进行下面的步骤之前,我们首先将它开启;现在,站点的URL就是由当前页面或文章的标题别名 (Alias)构成了。如果没有为当前页面或文章设置别名,那么URL会直接使用页面或文章的标题来构成URL(Title)。

如果你遇到问题,可以尝试修改configuration.php文件中的$live_site设置。如果你的Joomla安装在站点根路径中(例 如 public_html或htdocs),那么需要将$live_site设置为“/” 或 “http://www.example.com”或 “http://example.com”。如果站点安装在子路径中,就需要将$live_site设置为“/子路径名” 或 “http://www.example.com/子路径名”或 “http://example.com/子路径名”。

如果设置成功,那么现在URL应该由:

http://www.example.com/index.php?option=com_content&view=article&id=19&Itemid=27

变为:

http://www.example.com/index.php/joomla-overview

3.在全局设置中,将“为URL添加后缀(Add suffix to URLs)”设置为“开启(Yes)”,保存设置。

这只是一个“形式上”的步骤——为URL增加.html后缀,例如将:

http://www.example.com/index.php/joomla-overview

变为:

http://www.example.com/index.php/joomla-overview.html

4.在全局设置中,将“使用Apache的mod_rewrite(Use Apache mod_rewrite)”设置为“开启(Yes)”,保存设置。

注意,要使Apache的mod_rewrite正常开启,我们需要将站点根目录中的“htaccess.txt”文件重命名为“.htaccess”。

成功开启后,下面这样的URL:

http://www.example.com/index.php/joomla-overview.html

将被改变为:

http://www.example.com/joomla-overview.html

有一点建议,就是尽量为你站点中所有的页面和文章添加别名,这样就可以比较精确的控制SEF网址了;别名尽量只使用数字与字母,通过连字号“-”进行分隔,避免特殊符号。

更多关于joomla相关内容感兴趣的读者可查看本站专题:《Yii框架入门及常用技巧总结》、《php优秀开发框架总结》、《smarty模板入门基础教程》、《ThinkPHP常用方法总结》、《php面向对象程序设计入门教程》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》

希望本文所述对大家基于joomla程序设计有所帮助。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

11 Best PHP URL Shortener Scripts (Free and Premium) 11 Best PHP URL Shortener Scripts (Free and Premium) Mar 03, 2025 am 10:49 AM

11 Best PHP URL Shortener Scripts (Free and Premium)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Working with Flash Session Data in Laravel

Introduction to the Instagram API Introduction to the Instagram API Mar 02, 2025 am 09:32 AM

Introduction to the Instagram API

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Simplified HTTP Response Mocking in Laravel Tests

Build a React App With a Laravel Back End: Part 2, React Build a React App With a Laravel Back End: Part 2, React Mar 04, 2025 am 09:33 AM

Build a React App With a Laravel Back End: Part 2, React

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

cURL in PHP: How to Use the PHP cURL Extension in REST APIs

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

12 Best PHP Chat Scripts on CodeCanyon

Notifications in Laravel Notifications in Laravel Mar 04, 2025 am 09:22 AM

Notifications in Laravel

See all articles