Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hello Guys. .
i am in trouble can any one help me i wan to use my php page like wordpress
 
example my link : www.mydomain.com/page.php?name=cap
and i want my link like
 
www.mydomain.com/cap
 
anyone help me pls i really need this code thank in advance
Posted 19-Jan-13 10:47am
hasam53420

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This has nothing to do with masterpages or wordpress.
What you ask for is seo optimized url's. It is called url rewrite.
See this article for apache mod_rewrite: http://coding.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/[^], and IIS url rewrite: http://www.domagojsalopek.com/Details/Introduction-to-URL-Rewriting-using-IIS-URL-Rewrite-Module-and-Regular-Expressions/26/CommentPage[^]
  Permalink  
Comments
hasam53 at 19-Jan-13 16:17pm
   
Bro i didnt Get it Can you tell me with propre code :(
Zoltán Zörgő at 19-Jan-13 16:27pm
   
I doubt you have read the articles I have linked. There you have all. But here is an other, maybe you should start here: http://www.roscripts.com/Pretty_URLs_-_a_guide_to_URL_rewriting-168.html.
The key: you have t set up a rewrite rule in the web server, and direct all calls to a single entry. That one will be the router. You have to make your code to use this approach. I can't give you more code than in the article above, since there you have the basic implementation - more would be too much. But if you want you can consult the wordpress engine source too: http://wordpress.org/download/source/
hasam53 at 20-Jan-13 8:50am
   
bro i try it pretty URL but its not working :(
Zoltán Zörgő at 20-Jan-13 9:13am
   
What is not working? The url is working for sure. Aren't you behind a proxy blocking your access?
hasam53 at 20-Jan-13 9:18am
   
You Can See here www.softodix.com/photo/
 
i make code and put that in .htaccess but still my url ugly :(
Zoltán Zörgő at 20-Jan-13 9:22am
   
First of all: what is your rewriterule?
hasam53 at 20-Jan-13 9:53am
   
Mean ? i am just puting
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^image([0-9]+)/[A-Z0-9_-]+\.html$ /test.php?id=$1 [NC,L]
Zoltán Zörgő at 20-Jan-13 11:54am
   
I am sure this rule is not what you want. What is the pretty url you want to redirect?
/image/1 to /test.php?id=1?
Than you would need: RewriteRule ^image/([0-9]+)$ /test.php?id=$1 [NC,L]
But this is a partial solution, you need a router entry point if you want every url to be redirected.
You can test your rules here: http://martinmelin.se/rewrite-rule-tester/
hasam53 at 20-Jan-13 13:14pm
   
Yeah thanks Alot Bro coz of you i done it thanks aloT :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 240
1 Kamal Rocks 184
2 PIEBALDconsult 150
3 BillWoodruff 148
4 Jochen Arndt 135
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 19 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100