Htaccess doesn´t work - nice url

Hi guys i have problem with a htaccess.

I want from this URL domain.com/index?article=28&title=velky-biel-karlova-ves (it doesn´t have index.php because i hide .php extension with htaccess.

I wanna have this URL domain.com/clanok/28/velky-biel-karlova-ves

I used this code

My htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^clanok/([\d]+)/([\w-]+)/?$ index.php?article=$1&title=$2 [NC,L]

RewriteBase /

## hide .php extension
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]

## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]

My index.php file:

<a href="index.php?article=<?php echo urlencode($row['id']); ?>&title=<?php     echo createSlug($row['title']); ?>" title="">

It doesn´t work.

Thx for help.

728x90

1 Answers Htaccess doesn´t work - nice url

Try it like this you still have to mention index.php your php hide rule is different from this,

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^clanok/([\d]+)/([\w-]+)/?$ index.php?article=$1&title=$2 [NC,L]

Please ensure this rule is not conflicting with your existing rules.

2 year ago