I am working on updating a friends site, and he has an htaccess file that looks like this:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteBase /WWI
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?path=$1 [QSA,L,NC]
</IfModule>
Correct me if I am wrong because im still learning htaccess (wich is also why im here). But this code in combination with this php code determines wich page content needs to be loaded:
if(isset($_GET['path']) ){
$cPagina = $_GET['path'] . '.php';
} else {
$cPagina = 'indexContent.php';
}
include("partials/$cPagina");
So this is how the URL's look now:
www.development.dev/WWI/products/products_product
Wich just represents:
www.development.dev/WWI/products/products_product.php
This is accessed by:
< a href="/WWI/products/products_product" >
This construction, maybe outdated. But works fine.
So now this is the situation:
index.php?path=/WWI/producten/product_individueel&productid=3
And he wants to get this masked to:
www.development.dev/WWI/products/product/3
He also wants to keep as close to the current construction as possible, so I have tried this:
RewriteRule ^(.*)$ index.php?path=$1&product=$2 [QSA,L,NC]
So if I vardump the $_GET it returns this:
array (size=2)
'path' => string 'products/products_product' (length=29)
'product' => string '' (length=0)
How can I put for example the '3' inside that 'product' whilst the URL seems like products/product/3
However this let me realise how less I know about htaccess and it peaked my interest. So I got searching and reading tutorials on how this works etc. But I did not once encounter a problem where the path is saved in combination with a second parameter.
I hope the info I gave is enough, and I also hope this does not seem like I am not trying, but after 2 days fiddling arround with htaccess and reading manuals etc. I just thought, lets try stack overflow.
Thanks in advance