Improved SEO with mod_rewrite
PHP Advanced and Object-Oriented Programming Third Edition
<?php
//D:\wamp64\www\0613pm\w_wwwroot\n\test_htaccess\mod_rewrite.php echo '?w='.$_GET['w'].'&wb='.$_GET['wb']; /*
http://localhost/0613pm/w_wwwroot/n/test_htaccess/mod_rewrite.php?w='cheer'&wb='time'
http://localhost/0613pm/w_wwwroot/n/test_htaccess/mod_rewrite.php?w=%27cheer%27&wb=%27time%27
?w='cheer'&wb='time'
*/ /*
http://localhost/0613pm/w_wwwroot/n/test_htaccess/mod_rewrite.php?w=cheer&wb=time
?w=cheer&wb=time
*/ /*
D:\wamp64\bin\apache\apache2.4.18\conf #
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all denied
</Directory> */ /*
D:\wamp64\www\0613pm\w_wwwroot\n\test_htaccess
新建 .htaccess #2016/8/13-11:11
<IfModule mod_rewrite.c>
#the .htaccess file mustfirst check for the module and turn on the rewrite engine:
RewriteEngine on
#After enabling the engine, and before the closing IfModule tag, you add rules dictating the rewrites.
#The syntax is RewriteRule match rewrite
RewriteRule w.php dearchild.php
RewriteRule ^rewrite_ok/\wzero/\wfirst$ mod_write.php?w=$1&wb=$2
</IfModule> apache无法启动-0
#2016/8/13-11:04
<Directory 'D:\wamp64\www\0613pm\w_wwwroot\n\test_htaccess' />
AllowOverride All
<Directory>
apache无法启动-1
#2016/8/13-11:04
<Directory 'D:\wamp64\www\0613pm\w_wwwroot\n\test_htaccess' />
AllowOverride All
</Directory>
apache无法启动-2
#2016/8/13-11:04
<Directory "D:\wamp64\www\0613pm\w_wwwroot\n\test_htaccess" />
AllowOverride All
<Directory>
apache启动
#2016/8/13-11:04
<Directory "D:\wamp64\www\0613pm\w_wwwroot\n\test_htaccess">
AllowOverride All
<Directory>
TOOLS- Check http.conf syntax 逐步排错 */ /*
D:\wamp64\www\0613pm\w_wwwroot\n\test_htaccess\w.php
任意
D:\wamp64\www\0613pm\w_wwwroot\n\test_htaccess\dearchild.php
<?php
echo 'dear_child_w';
http://localhost/0613pm/w_wwwroot/n/test_htaccess/w.php */
echo 'dear_child_w';//dear_child_w
//验证通过
/*
RewriteRule somepage.php otherpage.php
With that code, any time a user goes to somepage.php, the user will be shown the contents ofotherpage.php, although the browser will still display somepage.php in the address bar.
To be clear, that’s not actually a good use of mod_rewrite, as a literal redirection could beaccomplished with the less complex mod_alias module instead. However, a line like that doesrepresent an easy way to test that mod_rewrite is working.
*/ /*
http://localhost/0613pm/w_wwwroot/n/test_htaccess/mod_write.php?w=wchild&wb=wchildb
Not Found The requested URL /0613pm/w_wwwroot/n/test_htaccess/mod_write.php was not found on this server. Apache/2.4.18 (Win64) PHP/5.6.19 Server at localhost Port 80 */ /*
http://localhost/0613pm/w_wwwroot/n/test_htaccess/rewrite_ok/wzero/wfirst
Not Found The requested URL /0613pm/w_wwwroot/n/test_htaccess/mod_write.php was not found on this server. Apache/2.4.18 (Win64) PHP/5.6.19 Server at localhost Port 80 #2016/8/13-11:44
<IfModule mod_rewrite.c>
#the .htaccess file mustfirst check for the module and turn on the rewrite engine:
RewriteEngine on
#After enabling the engine, and before the closing IfModule tag, you add rules dictating the rewrites.
#The syntax is RewriteRule match rewrite
RewriteRule w.php dearchild.php
RewriteRule ^rewrite_ok/\wzero/\wfirst$ mod_rwrite.php?w=$1&wb=$2
</IfModule> http://localhost/0613pm/w_wwwroot/n/test_htaccess/rewrite_ok/wzero/wfirst ?w=&wb=
//get空,继续修正
*/ /*
#2016/8/13-11:57
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule w.php dearchild.php
RewriteRule ^rewrite_ok/\w{1,}/\w{1,}$ mod_rewrite.php?w=$1&wb=$2
</IfModule> http://localhost/0613pm/w_wwwroot/n/test_htaccess/rewrite_ok/2er32/sd
//?w=&wb= #2016/8/13-11:58
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule w.php dearchild.php
RewriteRule ^rewrite_ok/(\w{1,})/(\w{1,})$ mod_rewrite.php?w=$1&wb=$2
</IfModule> http://localhost/0613pm/w_wwwroot/n/test_htaccess/rewrite_ok/2er32/sd
//?w=2er32&wb=sd 进一步研究-0
http://localhost/0613pm/w_wwwroot/n/test_htaccess/rewrite_ok/2er32
//Not Found The requested URL /0613pm/w_wwwroot/n/test_htaccess/rewrite_ok/2er32 was not found on this server. Apache/2.4.18 (Win64) PHP/5.6.19 Server at localhost Port 80 进一步研究-1
http://localhost/0613pm/w_wwwroot/n/test_htaccess/rewrite_ok/2er32/t/
//Not Found The requested URL /0613pm/w_wwwroot/n/test_htaccess/rewrite_ok/2er32/t/ was not found on this server. Apache/2.4.18 (Win64) PHP/5.6.19 Server at localhost Port 80 考虑用户习惯,优化正则, #2016/8/13-12:05
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule w.php dearchild.php
RewriteRule ^rewrite_ok/(\w{1,})/(\w{1,})/{0,}$ mod_rewrite.php?w=$1&wb=$2
</IfModule> http://localhost/0613pm/w_wwwroot/n/test_htaccess/rewrite_ok/2er32/t/
//?w=2er32&wb=t a-beautiful-world #2016/8/13-12:07
<IfModule mod_rewrite.c>
RewriteEngine on
#The syntax is RewriteRule match rewrite
RewriteRule w.php dearchild.php
RewriteRule ^rewrite_ok/(\w{1,})/(\w{1,})/{0,}/a-beautiful-world$ mod_rewrite.php?w=$1&wb=$2
</IfModule>
*/
http://localhost/0613pm/w_wwwroot/n/test_htaccess/rewrite_ok/2er32/ta-beautiful-world
//Not Found The requested URL /0613pm/w_wwwroot/n/test_htaccess/rewrite_ok/2er32/ta-beautiful-world was not found on this server. Apache/2.4.18 (Win64) PHP/5.6.19 Server at localhost Port 80 http://localhost/0613pm/w_wwwroot/n/test_htaccess/rewrite_ok/2er32/t/a-beautiful-world
//?w=2er32&wb=t
//Search Engine Optimization
Improved SEO with mod_rewrite的更多相关文章
- 使用Prerender.io为angular项目做SEO
现在的项目的为了更好的分工明确,降低耦合都开始采用前后端分离的形式进式开发,我们也采用这种开发形式,前端用angular开发.虽说刚开始也遇各种坑,但是后期熟悉了之后简直爽呆.一个比较大的坑就是SEO ...
- ThinkPHP的URL重写+路由+伪静态,实现SEO效果。
1.URL重写,隐藏网址中的Index.php. ThinkPHP 作为 PHP 框架,是单一入口的,那么其原始的 URL 便不是那么友好.但 ThinkPHP提供了各种机制来定制需要的 URL 格式 ...
- ASP.NET的SEO:正则表达式
目前国内主流的网站内容管理系统中,有大部分是可以将动态的PHP.ASP.ASPX等文档直接生成HTML的.但是由于有些网站的内容较多,因此如果单纯的采取直接生成的方式,将会占用大量的服务器资源.在这种 ...
- SEO教程:向百度要流量 第一季
首先祝贺你:当你看到这篇文章时,你已经站在一条通往SEO达人捷径的路口. 笔者也是今年年初才成为SEOer的一员,在做SEO的过程中,有不少自己独特的心得体会,所以一直酝酿着写一个SEO系列的文章,将 ...
- seo一些相关内容
PR值算法原理总体上基于下面2个前提: 1.一个网页被多次引用,则它可能是很重要的: 一个网页虽然没有被多次引用,但是被重要的网页引用,则它也可能是很重要的:一个网页的重要性被平均的传递到它所引用的网 ...
- 301重定向方法大全及SEO中网址规范化,看着不错先收下
301重定向方法大全及SEO中网址规范化 现在大多数网站都存在一些内容相同但网址(URL)不一样的重复内容,这些重复的内容对于搜索引擎来说却可能被认为是复制网页,复制网页虽然不会被惩罚但因多个网址存在 ...
- thinkphp之url的seo优化
1.网站url做seo优化的原因 SEO是由英文Search Engine Optimization缩写而来, 中文意译为“搜索引擎优化”.SEO是指通过对网站进行站内优化(网站结构调整.网站内容建设 ...
- SEO中常用的301永久重定向代码大全
301是永久重定向的意思,表示请求的网页已永久移动到新位置,服务器返回此响应(对 GET 或 HEAD 请求的响应)时,会自动将请求者转到新位置.其实301重定向在SEO中被广泛应用,也是被广泛认为比 ...
- 【微信SEO】公众号也能做排名?
[写于2016年8月] 最近,微信团队发出一则公告,开放公众号运营者一年内更改公众号名一次,这对不少名字起的奇葩名字(包括dkplus)的公众号来说是一件好事. 为什么说是好事呢?公众号名字直接关联到 ...
随机推荐
- Git教程学习(一)
教程来自: Git教程(廖雪峰的官方网站) 学习Git的基本内容,对教程内容进行理解并脱水 1. Git简介 2. 安装Git 1. ubuntu上安装Git $ sudo apt-get insta ...
- Linux install svn server
ref: http://blog.csdn.net/pingnanlee/article/details/8812520 1. yum -y install subversion 2. svnadmi ...
- Android遍历API (1) 动画篇——克隆动画AnimationCloning
从我学Android开始,一直就想做一件事.就是好好把APIDemo看一遍.今天开始会抽时间把Android官方的APIDemo程序全部过一遍.主要是为了两个目的:第一,复习以前学习的API用法.第二 ...
- 【九天教您南方cass 9.1】 14 坐标数据的纠正
同学们大家好,欢迎收看由老王测量上班记出品的cass9.1视频课程 我是本节课主讲老师九天. 我们讲课的教程附件也是共享的,请注意索取 在测量空间中. 九天老师的联系方式 点击直接请教九天老师吧! ...
- 【转】WPF自定义控件与样式(8)-ComboBox与自定义多选控件MultComboBox
一.前言 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等. 本文主要内容: 下拉选择控件ComboBox的自定义样式及扩展: 自定义多选控件Mul ...
- Ubuntu 14.04 下搭建SVN服务器 (转载自 http://www.linuxidc.com/Linux/2015-01/111956.htm)-------------我所用到是红色字体
http://www.linuxidc.com/Linux/2015-01/111956.htm Ubuntu 14.04 下搭建SVN服务器 svn:// 安装软件包: sudo apt-get i ...
- lua系列之 lua-cjson模块安装报错问题解决
lua-cjson下载 下载地址 报错信息 [root@LeoDevops lua-cjson]# make cc -c -O3 -Wall -pedantic -DNDEBUG -I/usr/loc ...
- SpringBoot Logback配置,SpringBoot日志配置
SpringBoot Logback配置,SpringBoot日志配置 SpringBoot springProfile属性配置 ================================ © ...
- LostRoutes项目日志——敌人精灵Enemy解析
Enemy类在Enemy.js中,类Enemy类继承自PhysicsSprite,以便于可以使用物理引擎中的一些特性. 原版的Enemy.js: var Enemy = cc.PhysicsSprit ...
- android基础---->XMl数据的解析
在网络上传输数据时最常用的格式有两种,XML和JSON,下面首先学一下如何解析XML格式的数据,JSON的解析可以参见我的博客(android基础---->JSON数据的解析).解析XML 格式 ...