性感的.htaccess URL重写 [英] .htaccess sexy url rewrites

查看:109
本文介绍了性感的.htaccess URL重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要得到我的所有域重写和好看。例如:

example.com/blog.php?article=the-name-of-article 变成 example.com/blog/the-name-of-article

所以我要带.php?文章=被改变成/

我目前的.htaccess文件如下:

 选项+了FollowSymLinks -MultiViews
RewriteEngine叙述上

的RewriteBase /

##隐藏PHP扩展
##要外部重定向/dir/foo.php到/ DIR /富
的RewriteCond%{THE_REQUEST} ^ [AZ] {3,} \ S([^。] +)\。PHP [NC]
重写规则^%1 [R,L,NC]

##在内部重定向/ DIR /富到/dir/foo.php
的RewriteCond%{} REQUEST_FILENAME -f .PHP
重写规则^%{REQUEST_URI}的.php [L]
 

但所有这确实是下降了的.php

我一直在寻找周围,但我只是想听听大家是如何实现这一那么容易。

解决方案

 重写规则^博客/(.*)$ blog.php的?文章= $ 1 [QSA,L]
 

I want to get all my domains to rewrite and look good. for example:

example.com/blog.php?article=the-name-of-article to become example.com/blog/the-name-of-article

so i want the .php?article= to be changed into a /

my current .htaccess file looks like:

Options +FollowSymLinks -MultiViews
rewriteengine on

RewriteBase /

## Hide .php extension
## To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]

## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]

but all that does is drop the .php

I have been searching around but I just want to hear how everyone accomplishes this so easily.

解决方案

RewriteRule ^blog/(.*)$ blog.php?article=$1 [QSA,L]

这篇关于性感的.htaccess URL重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆