I have problem with this:
RewriteEngine On
RewriteRule ^tuote/([^/]+) tuote.php?data=$1 [L]
it should change all tuote/Something-Something to tuote.php?data=Something-Something in server side (not redirect) but seems not to work ($_GET['data'] gets no value).
And other question:
How could I make this 1-Something-title-nice-title to go php
$first_part = "1";
$secnd_part = "Something-title-nice-title";
tried explode, but it does not work in this case.
—-EDIT—-
Thank you for replies.
I changed htaccess file to:
RewriteEngine On
RewriteRule ^tuote/(.+) tuote.php?data=$1 [L]
but still $_GET['data'] value is empty. BTW, I have other htaccess in parent directory, maybe it would affect in the code?
The other htaccess file has content:
<IfModule mod_php.c>
php_flag display_errors 1
</IfModule>
AuthUserFile /var/www/somepath/.htpasswd
AuthGroupFile None
AuthName "Kirjaudu sisään"
AuthType Basic
require valid-user
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]
And about 2nd question, it started to work. Thank you!
RewriteRule ^(.*)$ route.php?data=$1 [L]then see what’s inside $_GET[‘data’], that should give you a clue about why your rule is not oring.If it’s not working, AllowOverride is not working. Confirm by misspelling directive in .htaccess without any effect on apache.
If you do get the string, try replace it with more strict rule.
For your second question, you can do this
Alternatively you can have your regexp select separate parts of your URL into different variables $2 $3 etc.