php.htaccessurlclean-urlget-method

how to Change a GET method URL to clean URL in php?


This is an URL that created by GET method in php to send DATA parameter to archives.html page:

http://127.0.0.1/archives.html?option=com_archive&date=16-2-2014

Is there any way to clean this URL?

I want to do something like this (and I can send parameter too!)

http://127.0.0.1/archives.html/16-2-2014

Can I do that by mod_rewrite?

(I am developing a component on joomla3)


Solution

  • You can use this rule in your root .htaccess:

    RewriteEngine On
    
    RewriteRule ^(archives\.html)/([0-9-]+)/?$ /$1/?option=com_archive&date=$2 [L,NC,QSA]