Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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和动态url结合使用?_.htaccess - Fatal编程技术网

.htaccess-是否可以将静态url和动态url结合使用?

.htaccess-是否可以将静态url和动态url结合使用?,.htaccess,.htaccess,目前,我使用以下代码将.htaccess文件中的动态URL转换为静态URL: RewriteRule ^([a-z0-9_\-]+)$ /index.php?page=$1 [L,NC] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?page=([^&]+)\ HTTP/ RewriteRule ^index\.php$ http://www.mywebsite.com/%1? [R=301,L] 我想知道的是,是否有可能更

目前,我使用以下代码将.htaccess文件中的动态URL转换为静态URL:

RewriteRule ^([a-z0-9_\-]+)$ /index.php?page=$1 [L,NC]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?page=([^&]+)\ HTTP/
RewriteRule ^index\.php$ http://www.mywebsite.com/%1? [R=301,L]

我想知道的是,是否有可能更改此规则,以便可以通过
www.mywebsite.com/news
访问页面,但也可以附加额外的
$\u GET
信息,例如:
www.mywebsite.com/news?id=1

您想看看,在构建查询字符串后,它将附加查询字符串:

RewriteRule ^([a-z0-9_\-]+)$ /index.php?page=$1 [L,NC,QSA]
这使得它成为对
http://www.mywebsite.com/news?id=1
内部重写为:
/index.php?page=news&id=1