Jump to content

www.com/index.php?page=about to www.com/about


markveidemanis

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.