markveidemanis Posted November 27, 2013 Share Posted November 27, 2013 I have started to write a website from scratch and would like to know how to use mod_rewrite in order to shorten urls. I want to shorten http://f.marktest.co.uk/index.php?page=about to: http://f.marktest.co.uk/about I have tried several methods but was unable to find anything that worked. Link to comment https://forums.phpfreaks.com/topic/284336-wwwcomindexphppageabout-to-wwwcomabout/ Share on other sites More sharing options...
Ch0cu3r Posted November 27, 2013 Share Posted November 27, 2013 You will need to recode your links to the new url format, eg <a href="http://site.com/about">About Us</a> Then you can apply the following in an .htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?page=$1 Link to comment https://forums.phpfreaks.com/topic/284336-wwwcomindexphppageabout-to-wwwcomabout/#findComment-1460385 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.