Apache 2.4重写URL

时间:2018-10-13 14:03:29

标签: .htaccess apache2.4

我有这种url类型(这是一个例子)(php 7.2):

https://www.domaine.net/demo/index.php
https://domaine.net/demo/index.php?Info&Contact
https://domaine.net/demo/index.php?cPath=1
https://domaine.net/demo/index.php?cPath=1_2
https://www.domaine.net/demo/index.php?Products&Description&products_id=1
https://www.domaine.net/demo/index.php?Products&Description&products_id=2

似乎Apache 2.4引入了新元素。 像这样如何正确重写此URL。我对htaccess不太了解。 对我来说很难。

https://domaine.net/demo/Info&Contact
https://domaine.net/demo/cPath=1
https://domaine.net/demo/cPath=1_2
https://www.domaine.net/demo/Products&Description&products_id=1
https://www.domaine.net/demo/Products&Description&products_id=2

我从什么开始:

<IfModule mod_rewrite.c>
Options -MultiViews

#Tell PHP that the mod_rewrite module is ENABLED.
SetEnv HTTP_MOD_REWRITE On
RewriteEngine On

#WWW => NON-WWW:
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^ %{REQUEST_SCHEME}://%1%{REQUEST_URI} [R=301,L]


RewriteRule . - [E=REWRITEBASE:/] #not sur
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
????
</IfModule>

Tk

0 个答案:

没有答案