We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How to change the address bar url in php ?

Hi,

can any body, tell me how to follow the url rewriting using .htaccess. Am using xampp,where can i able to find .htaccess file. How to change/add in the .htaccess file,
to get the changed URL in the address bar


http://www.example.com?name=value

to change in the address bar as

http://www.example.com


Please any body help me out. Thanks in advance

4
Contributors
5
Replies
1 Day
Discussion Span
1 Year Ago
Last Updated
7
Views
jacksantho
Junior Poster
169 posts since Feb 2011
Reputation Points: 7
Solved Threads: 0
Skill Endorsements: 0

You have to create a .htaccess file using an editor like notepad or notepad++, before that you should activate the rewrite option in httpd.conf.
Use this link to understand how to activate this http://www.lancelhoff.com/enabling-htaccess-in-apache-on-windows/.
The part with the rewrite it is new for me so I can help you just with this video http://www.youtube.com/watch?v=oqg6Chk6L7M and maybe a sample of .htaccess file.
I you want the sample give me a replay Good luck

dany12
Posting Whiz in Training
223 posts since Aug 2010
Reputation Points: 21
Solved Threads: 15
Skill Endorsements: 1

Hi,

Am running XAMPP.

my path of the php script is
/htdocs/emp/emp.php

http://localhost/emp.php

when i click the employee(hyper link), the path changes to
http://localhost/empdetails.php?name=saran

i don't know to write the .httaccess file.

My URL should always point to http://localhost/emp.php


Please help me out

jacksantho
Junior Poster
169 posts since Feb 2011
Reputation Points: 7
Solved Threads: 0
Skill Endorsements: 0

you mean there's an htaccess already and it's ruining the normal operation? because if there's no htaccess, then the path /htdocs/emp/emp.php will be viewed in http://localhost/emp/emp.php, take note of the folder "emp".

vaultdweller123
Posting Pro
574 posts since Sep 2009
Reputation Points: 47
Solved Threads: 81
Skill Endorsements: 2

I understand that you don't have a htaccess file in your folder with the project emp and you want to redirect localhost tolook like http://localhost/emp.php.
To do that you will have to use my first post and enable htaccess using that and then you will have to change some settings in your xampp.
Xampp is known for it's problems like when you type just localhost it will go to the index of xampp not you custom index.
Hope that helps you,if not try to watch killerphp advanced php part 7 to understand htaccess.
Bye

dany12
Posting Whiz in Training
223 posts since Aug 2010
Reputation Points: 21
Solved Threads: 15
Skill Endorsements: 1

Is SEO impt to you? What about rewriting to this format?

http://localhost/emp/details/saran

http://localhost/empdetails.php?name=saran

RewriteEngine On
RewriteRule ^emp/details/([^/]*)$ /empdetails.php?name=$1 [L]
diafol
Keep Smiling
Moderator
10,672 posts since Oct 2006
Reputation Points: 1,632
Solved Threads: 1,514
Skill Endorsements: 57

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0668 seconds using 2.66MB