dimanche 31 août 2014

htaccess clean urls without modifying base url


Vote count:

0




I'm trying to clean the url



/file.php?page=[whatever]


to



/file/[whatever]


using .htaccess. The file.php resides in the root public_html folder.


The below code works perfectly, but even though I've specified the file type as php it still applies to other files (such as css) and breaks links!


The two solutions I've found on the internet are:




  • Avoid relative links to external files and include the full path




  • add my domain in the base tag to the head of every .html page




I don't want to do either of these as they make me unable to work on the site locally with MAMP/XAMPP.



RewriteRule ^file/([^/\.]+)/?$ file.php?p=$1 [L]


asked 1 min ago

Joe

5






htaccess clean urls without modifying base url

Aucun commentaire:

Enregistrer un commentaire