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)的公众号来说是一件好事. 为什么说是好事呢?公众号名字直接关联到 ...
随机推荐
- ansible执行shell模块和command模块报错| FAILED | rc=127 >> /bin/sh: lsof: command not found和| rc=2 >> [Errno 2] No such file or directory
命令: ansible -i hosts_20 st -m shell -a 'service zabbix_agentd star' -K --become ansible -i hosts_2 ...
- BW中DSO的分类及应用
1.DSO的分类,标准DSO(生成主数据标识.对于相同关键字段的值进行合并.可直接出具报表).写优化的DSO(不生成主数据标识.不合并相同关键字段的值.速度快可用于存储大容量数据).直接写入的DSO, ...
- 【iCore4 双核心板_ARM】例程五:SYSTICK定时器 实验——定时点亮LED
实验原理: 通过STM32的三个GPIO口驱动三色LED的三个通道,设定GPIO为推挽输出模式,采 用灌电流方式与LED连接,输出高电平LED灭,输出低电平LED亮,通过系统定时器实现 1s定时,每秒 ...
- 看雪CTF第十五题
1.直接运行起来,再用OD附加 在此处luajit加载并调用main函数 004021C7 E8 64FE0000 call CrackMe. ; luaL_newstate 004021CC 8BF ...
- Paypal Rest Api自定义物流地址(跳过填写物流地址)
PayPal之前的Rest Api是不支持自定义物流地址的,最新升级版本的提供了这个服务(Payment Experience),大概步骤如下: 1.申请一个自定义的配置ID 自定义配置包括Logo, ...
- vue.js是什么
Vue.js(读音 /vjuː/, 类似于 view) 是一套构建用户界面的 渐进式框架.与其他重量级框架不同的是,Vue 采用自底向上增量开发的设计.Vue 的核心库只关注视图层,并且非常容易学习, ...
- myeclipse创建hibernate工程
1.创建数据库: from blog http://www.cnblogs.com/zhaocundang/p/9061959.html 使用navicat mysql IDE: 创建数据库 book ...
- Golang Gin 框架 Route备注
https://www.jianshu.com/p/d4b52187d233 https://blog.csdn.net/weixin_34210740/article/details/8602756 ...
- [PGM] Variable elimination and Belief propagation
内容范围如题.Lec 08-11的内容:https://www.youtube.com/watch?v=Qa04kw1gKHk&index=36&list=PLQiVpyxVlLkbp ...
- [OpenCV] Samples 14: kalman filter
Ref: http://blog.csdn.net/gdfsg/article/details/50904811 #include "opencv2/video/tracking.hpp&q ...