URL issue ... need help with this :/

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

bitsys
New php-forum User
New php-forum User
Posts: 3
Joined: Sat Oct 20, 2012 4:41 am

URL issue ... need help with this :/

Postby bitsys » Sat Oct 20, 2012 4:54 am

hello members
I have created a php website and its almost complete but the only thing that keeps bugging me is the way url is being displayed. To be more specific i have the link showing up in the address bar in eg www.mywebsite.com/index.php?page=contact fashion whereas i want it to be displayed as www.mywebsite.com/contact.
kindly help me with this issue..

thanks in advance

User avatar
simplypixie
php-forum Active User
php-forum Active User
Posts: 300
Joined: Sun Dec 11, 2011 12:51 am
Location: Shrewsbury, Shropshire
Contact:

Re: URL issue ... need help with this :/

Postby simplypixie » Mon Oct 22, 2012 2:55 am

You need to use .htaccess file to make 'friendly' urls, so create a file called .htaccess (if not already there) in your site root and add something like this (not tested):

Code: Select all

RewriteEngine on
RewriteRule ^/([a-zA-Z0-9]+)\$ index.php?page=$1

bitsys
New php-forum User
New php-forum User
Posts: 3
Joined: Sat Oct 20, 2012 4:41 am

Re: URL issue ... need help with this :/

Postby bitsys » Mon Oct 22, 2012 6:53 am

thanx for the kind reply simplypixie :) finally figured out how it is to be resolved...
cheers


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 4 guests