I need to format my URL using .htaccess file but my script not working

This is my URL
http://www.example.com/details.php?id=12&page=120.v2013-09-18.by.Acme

My htaccess script

RewriteEngine On
RewriteRule ^details/([^/]*)/([^/]*).html$ /details.php?id=$1&post=$2 [L] 

I need to get my URL to
http://www.example.com/details/12/120.v2013-09-18.by.Acme.html

how can i change my url to above format. Please help me.


Source: .htaccess

1 Comment

  1. Digin Dominic

    You need another rule to redirect old url to pretty URL:

    Options -MultiViews
    RewriteEngine On
    RewriteBase /

    RewriteCond %{THE_REQUEST} /details.php?id=([^s&]+)&post=([^s&]+)s [NC]
    RewriteRule ^ /detail/%1/%2? [R=302,L,NE]

    RewriteRule ^details/([^/]+)/([^.]+).html$ details.php?id=$1&post=$2 [L,QSA,NC]

    Reply

Leave a Reply