This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes PHP and the fly likes Use htaccess to implement pretty URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Languages » PHP
Bookmark "Use htaccess to implement pretty URL" Watch "Use htaccess to implement pretty URL" New topic
Author

Use htaccess to implement pretty URL

Hikari Shidou
Ranch Hand

Joined: Jan 22, 2013
Posts: 88
Hello!

I use pretty permalink in Wordpress. Apache's htaccess takes a GET URL like http://domain/path/value1/value2/value3/value4/ and serves it to PHP as something like http://domain/path/index.php?par1=value1&par2=value2&par3=value3&par4=value4

With Wordpress it works fine, but I need to implement it on a raw PHP software, without Wordpress tricks. I googled for a PHP solution and couldn't find one, not even an htacces example that would work without a CMS or framework.

If at least I could receive "/value1/value2/value3/value4/" in PHP I could split it, but not even that I'm able to do. Of course, be able to directly get each variable from $_GET would be better.

The maximum I was able to do was 301 redirect to http://domain/path/index.php?par1=value1&par2=value2&par3=value3&par4=value4 but that's not what I wanna do. I want browser to keep showing http://domain/path/value1/value2/value3/value4/ on address bar.

Could somebody give me hints, on a tutorial or at least a htaccess example?

Note I must be able to set 'domain' and 'path' separately, because the software may be installed on a domain root or inside a folder. And it must always go to index.php.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use htaccess to implement pretty URL
 
Similar Threads
How to Handle Properties
String.split() question
text file extractor
How to convert query string into xml Structure
Walk distinct values in xsl key 4 at a time