Heim Backend-Entwicklung PHP-Tutorial queryphp框架教程三 做SEO优化 以.html结尾去除index.php解决思路

queryphp框架教程三 做SEO优化 以.html结尾去除index.php解决思路

Jun 13, 2016 pm 01:52 PM
html index nbsp quot

queryphp框架教程三 做SEO优化 以.html结尾去除index.php
前二篇教程
http://topic.csdn.net/u/20100228/22/3bea834b-efc0-4aa0-af4a-a4923af8b60c.html
http://topic.csdn.net/u/20100226/12/43bf3dc5-795f-4fa5-861a-2f7bf8fd0cd6.html
下载 目前最新0.9.6.8beta版
http://code.google.com/p/queryphp/downloads/list

去除index.php测试

C:\WINDOWS\system32\drivers\etc\hosts文件添加一行
内容如下
127.0.0.1 localhost
192.168.0.10 www.app.com

192.168.0.10的是你自己apache使用的IP,就是下面
*号中的IP,反证能访问你的本地网卡就可以了

http://www.app.com/queryphp/project/index.php/default/index
配置后希望可以变成这样子
http://www.app.com/queryphp/project/default/index.html
记得在inc.ini.php文件里面加多一行
$config['html']='.html'; 或把前面那个//去掉,这样就可以了
虚拟主机配置测试,AllowOverride FileInfo 将会使用.htaccess配置

 
  Order allow,deny
  Allow from all
AllowOverride FileInfo
 

  DocumentRoot "D:/work"
  ServerName "www.app.com"



.htaccess文件 放在project目录下面 就是每个项目目录下面,这样就会访问同级目录
index.php文件

  RewriteEngine On

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  #RewriteBase /

  # we skip all files with .something
  #RewriteCond %{REQUEST_URI} \..+$
  #RewriteCond %{REQUEST_URI} !\.html$
  #RewriteRule .* - [L]

  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ index.php [QSA,L]


------------------------
程序中使用url_for()方式


模板中示示例 我们还是以CURD方式

  ">编辑
  ">删除

下载后在并在apache设置www.app.com 在c:/windows/system
http://www.app.com/queryphp/project/curd/index

是不是可以显示内容了


如果显示了 在framework\config\inc.ini.php 文件中把下面这行内容去掉注释
//$config['html']='.html';//开启.html结尾url


http://www.app.com/queryphp/project/curd/index.html 访问
是不是可以看到内容了

所有链接都带.html结尾了。那我们有时候想不要.html结尾怎么办
">删除

url_for(url,true);方式 表示不要html结尾
删除会变成这样子
http://www.app.com/queryphp/project/curd/delete/id/2

------解决方案--------------------
wow 顶

------解决方案--------------------
试问LZ用过那几种框架
------解决方案--------------------

探讨
用过几种,目前基本是山寨symfony+doctrine ORM类
自己也在使用,不过感觉太大了,自己写一个小的。

------解决方案--------------------
反反复复共发放给法国风格
------解决方案--------------------
做OA,或企业网站,初学者.用什么框架好
------解决方案--------------------
支持~~~~~~~~~~~~~~~~~~~~~~学习。
------解决方案--------------------
学习了

------解决方案--------------------
urlrewrite老是不太明白

Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn

Heiße Artikel -Tags

Notepad++7.3.1

Notepad++7.3.1

Einfach zu bedienender und kostenloser Code-Editor

SublimeText3 chinesische Version

SublimeText3 chinesische Version

Chinesische Version, sehr einfach zu bedienen

Senden Sie Studio 13.0.1

Senden Sie Studio 13.0.1

Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver CS6

Dreamweaver CS6

Visuelle Webentwicklungstools

SublimeText3 Mac-Version

SublimeText3 Mac-Version

Codebearbeitungssoftware auf Gottesniveau (SublimeText3)

Verschachtelte Tabelle in HTML Verschachtelte Tabelle in HTML Sep 04, 2024 pm 04:49 PM

Verschachtelte Tabelle in HTML

Tabellenrahmen in HTML Tabellenrahmen in HTML Sep 04, 2024 pm 04:49 PM

Tabellenrahmen in HTML

HTML-Rand links HTML-Rand links Sep 04, 2024 pm 04:48 PM

HTML-Rand links

HTML-Tabellenlayout HTML-Tabellenlayout Sep 04, 2024 pm 04:54 PM

HTML-Tabellenlayout

Text in HTML verschieben Text in HTML verschieben Sep 04, 2024 pm 04:45 PM

Text in HTML verschieben

HTML-geordnete Liste HTML-geordnete Liste Sep 04, 2024 pm 04:43 PM

HTML-geordnete Liste

HTML-Onclick-Button HTML-Onclick-Button Sep 04, 2024 pm 04:49 PM

HTML-Onclick-Button

Wie analysiert und verarbeitet man HTML/XML in PHP? Wie analysiert und verarbeitet man HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

Wie analysiert und verarbeitet man HTML/XML in PHP?

See all articles