Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess-如何在没有参数的情况下重写url_.htaccess_Url_Permalinks - Fatal编程技术网

.htaccess-如何在没有参数的情况下重写url

.htaccess-如何在没有参数的情况下重写url,.htaccess,url,permalinks,.htaccess,Url,Permalinks,嗨,我还有一个问题 我有最简单的途径 RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] 它为我提供了友好的URL,例如www.mysite.loc/blog/ 但我想更进一步,比如www.mysite.loc/blog/?page=1和www.mysite.loc/blog/?pag

嗨,我还有一个问题

我有最简单的途径

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
它为我提供了友好的URL,例如www.mysite.loc/blog/

但我想更进一步,比如
www.mysite.loc/blog/?page=1
www.mysite.loc/blog/?page=1&id=1

我该怎么做


顺便说一句,我在谷歌上找到了很多解决方案,但都不管用。

也许你想要这样的解决方案:

RewriteRule ^(.*)$ /index.php?url=$1&%{query_string} [L]
这样,对
/blog/?page=1
的请求将映射到
/index.php?url=/blog/&page=1
/blog/abc/?page=3
将映射到
/index.php?url=/blog/abc/&page=3


然后,您将解析
$\u GET['url']
以了解浏览器需要什么资源。

thanx@grossvogel您的帖子帮助了我:)