Forum Moderators: phranque
I did read all previous posts on this subject but somehow I could not get it working for me, so any help would be appreciated.
What I want to do:
I want to create search engine friendly urls from dynamicly generated php pages.
Example:
[example.com...]
What I want to transform it in is:
[example.com...]
I will have to work with a .htaccess file
the domainname is hosted on a shared hosting plan (multiple domains on 1 IP)
Hope this info covers everything for you guys to give suggestions. As I am a total newbie, please post the complete code I should use.
Thanks in advance!
Steve
[edited by: Brett_Tabke at 12:42 pm (utc) on June 10, 2004]
[edit reason] examplified. [/edit]
[example.com...]
=>
[example.com...]
You really need to go back to the drawing board and work out how many variables you have, what order and what they're called...
[edited by: Brett_Tabke at 12:42 pm (utc) on June 10, 2004]
The Regular Expression you used will not work mainly because of the "\.*" expression, which matches zero or more occurrence of the . (dot) character. You need to use .* to achieve what you want (match zero or more occurrence of any text). But because this will match anything and everything, it might not be working as it can be expected, so I changed it a bit. I suggest you to try the following:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /shop
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ product.php?platform=$1&id=$2&title=$3 [L]
You need to put this into a htaccess file in the directory where the www.domain.com/shop url points to, or if you've placed it somewhere else, then you need to change some of the directives to make it work.
Ref: Regular Expressions Tutorial [etext.lib.virginia.edu]
Jim
if my game title has more words (as most of them do) then I get an ugly url afterall in the browser address bar.
like [example.com...]
with the %20 signs for the space between the title
can I change that so it gives me
[example.com...]
with the code I've got from gergoe?
Thanks!
[edited by: Brett_Tabke at 12:43 pm (utc) on June 10, 2004]
Options +FollowSymLinks
RewriteEngine on
RewriteBase /shop
[b]RewriteRule ^([^/]+/[^/]+/[^/]+)-([^/]+)/?$ $1\%20$2 [N][/b]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ product.php.ihtml?platform=$1&id=$2&title=$3 [L]