在.htaccess重写查询字符串重写、字符串、htaccess

由网友(你这辈子只能是我的)分享简介:我试图做一个查询字符串的一个非常简单的重写和我有没有运气可言。我需要从I'm trying to do a very simple rewrite of a query string and I'm having no luck at all. I need to go fromHTTP://例如点com / ACT...

我试图做一个查询字符串的一个非常简单的重写和我有没有运气可言。我需要从

I'm trying to do a very simple rewrite of a query string and I'm having no luck at all. I need to go from

HTTP://例如点com / ACT = jQuery的

http:// example dot com/?ACT=jquery

HTTP://例如点com / index.php的ACT =的jQuery

http:// example dot com/index.php?ACT=jquery

这是我写在我的.htaccess文件中的code和它抛出了我一个内部服务器错误。我真的在这个新的全mod-rewrite业务,所以任何帮助将大大AP preciated。

This is the code that I've written in my .htaccess file and it throws me an internal server error. I'm really new at this whole mod rewrite business so any help would be greatly appreciated.

RewriteEngine叙述在 的RewriteCond%{QUERY_STRING} ^(ACT = jQuery的)$ 重写规则^(。*)$的index.php /?act =被jQuery的

RewriteEngine On RewriteCond %{query_string} ^(ACT=jquery)$ RewriteRule ^(.*)$ index.php/?ACT=jquery

推荐答案

如果你只是希望它拿起PHP文件,不需事先告知浏览器:

If you just want it to pick up the php file without informing the browser:

RewriteEngine On
RewriteRule ^/?ACT=jquery$ index.php/?ACT=jquery [PT,L]

如果您希望浏览器更改书签等创建cononical网址:​​

If you want the browser to change bookmarks etc. to create a cononical URL:

RewriteEngine On
RewriteRule ^/?ACT=jquery$ index.php/?ACT=jquery [R=301,L]

假设任意参数:

Assuming arbitrary arguments:

RewriteEngine On
RewriteRule ^/?(.*)$ index.php/?$1 [PT,L]

或者,你可能preFER脚本别名:

Or you might prefer a script alias:

ScriptAliasMatch ^(.*)?(.*)$ index.php
阅读全文

相关推荐

最新文章