Adas
Adas

Reputation: 309

Dynamic url change into seo friendly url

A very common problem, but couldn't fix the issue.

I want

 http://website.de/page.php?module=helios

into

 http://website.de/page/helios

I have tried lots of .htaccess code like this one, but still page sends to 404.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ page.php?module=$1

Please provide some suggestions.

Upvotes: 1

Views: 754

Answers (3)

Gaurav Rai
Gaurav Rai

Reputation: 928

Use this use your base path

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^page/(.*)$ page.php?module=$1

Upvotes: 0

Joe Birkin
Joe Birkin

Reputation: 110

Try...

RewriteRule ^page/([^/]*)/$ /page.php?module=$1 [L]

Upvotes: 0

anubhava
anubhava

Reputation: 785876

Try this rule in your site root .htaccess:

Options -MultiViews
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^page/([^/]+)/?$ page.php?module=$1 [L,NC,QSA]

Upvotes: 2

Related Questions