Click here to Skip to main content
Sign Up to vote bad
good
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 - 9:47
hasam53420


1 solution

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 - 19 Jan '13 - 16:17
Bro i didnt Get it Can you tell me with propre code :(
Zoltán Zörgő - 19 Jan '13 - 16:27
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 - 20 Jan '13 - 8:50
bro i try it pretty URL but its not working :(
Zoltán Zörgő - 20 Jan '13 - 9:13
What is not working? The url is working for sure. Aren't you behind a proxy blocking your access?
hasam53 - 20 Jan '13 - 9:18
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ő - 20 Jan '13 - 9:22
First of all: what is your rewriterule?
hasam53 - 20 Jan '13 - 9:53
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ő - 20 Jan '13 - 11:54
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 - 20 Jan '13 - 13:14
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
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 508
1 Arun Vasu 275
2 Mahesh Bailwal 259
3 Maciej Los 238
4 Rohan Leuva 176
0 Sergey Alexandrovich Kryukov 9,660
1 OriginalGriff 7,329
2 CPallini 3,968
3 Rohan Leuva 3,339
4 Maciej Los 2,851


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 19 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid