Chill Web Designs
Chill Web Designs

Reputation: 1331

Restructure urls using .htaccess file

I need to convert links such as

http://www.example.co.uk/blog/archive.php?date=2012-05

to

http://www.example.co.uk/blog/archive/2012/05/

using php or .htaccess file.

.htaccess file

RewriteEngine on
RewriteRule ^blog/archive/([0-9]+)/([0-9]+)/$ http://www.example.co.uk/blog/archive.php?date=$1-$2 [NC]

Ive have tried this but not having any luck. Any ideas or help would be appreciated.

Upvotes: 1

Views: 246

Answers (1)

anubhava
anubhava

Reputation: 785196

Put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^blog/archive/([0-9]+)/([0-9]+)/?$ blog/archive.php?date=$1-$2 [NC,L,QSA]

Upvotes: 1

Related Questions