user39980
user39980

Reputation:

Creating simple URL's (.htaccess - mod_rewrite)

I have this structure for my navigation index.php?v=page

I am looking to convert it to: www.domain.com/page/ - using mod_rewrite..any ideas on that? I read through some tuts and examples, but couldnt get it working right.

Upvotes: 1

Views: 438

Answers (1)

Jonathan
Jonathan

Reputation: 5993

Here's some examples.

RewriteEngine on

# www.domain.com/page/example changed to index.php?page=example
RewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L]

# www.domain.com/example changed to index.php?v=example
RewriteRule ^example(/)?$ index.php?v=example [L]

The second rule sounds like what you're after.

Upvotes: 2

Related Questions