Mod rewrite URL重写apache2
我怎样才能重写Mod rewrite URL重写apache2,mod-rewrite,url-rewriting,apache2,regex,Mod Rewrite,Url Rewriting,Apache2,Regex,我怎样才能重写 anyhost.com/argument1/parameter2/some text/ 作为 anyhost.com/index.php?path=argument1/parameter2/some text/ 或 anyhost.com/index.php?page=argument1&subpage=parameter2&subsubpage=some text 或者类似的东西?这应该可以: RewriteEngine On # First example RewriteR
anyhost.com/argument1/parameter2/some text/
作为
anyhost.com/index.php?path=argument1/parameter2/some text/
或
anyhost.com/index.php?page=argument1&subpage=parameter2&subsubpage=some text
或者类似的东西?这应该可以:
RewriteEngine On
# First example
RewriteRule ^(.*)$ index.php?path=$1 [L,QSA]
# Second example
RewriteRule ^(.*)/(.*)/(.*)$ index.php?page=$1&subpage=$2&subsubpage=$3 [L,QSA]
方法是将原始URL中的任何查询字符串自动附加到发送到index.php的查询字符串中;如果不需要该功能,可以将其删除
RewriteRule (.*)?/ index.php?path=$1
这是第一个版本
RewriteRule (.*)/(.*)/(.*)?/ index.php?page=$1&subpage=$2&subsubpage=$3
这是第二个。您可以随时使用测试您的重写。您尝试过什么?另外,为了搜索引擎优化等目的,我想你可能在向后看。是的,我认为第一条规则正是我想要的。谢谢!