views:

48

answers:

1

I have this structure for my navigation index.php?v=page

I am looking to convert it to: www.domain.com/page/ - using mod_rewrite..any ideas on that? I read through some tuts and examples, but couldnt get it working right.

Thanks,

Ryan

+2  A: 

Here's some examples.

RewriteEngine on

# www.domain.com/page/example changed to index.php?page=example
RewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L]

# www.domain.com/example changed to index.php?v=example
RewriteRule ^example(/)?$ index.php?v=example [L]

The second rule sounds like what you're after.

Jonathan
Thanks, i have something like this:RewriteRule ^features(/)?$ index.php?v=features [L]RewriteRule ^benefits(/)?$ index.php?v=benefits [L]RewriteRule ^faq(/)?$ index.php?v=faq [L]RewriteRule ^pricing(/)?$ index.php?v=pricing [L]RewriteRule ^get-started(/)?$ index.php?v=get-started [L]And if I have a couple of sites on one hosting account, this goes in the root dir?Thank you!
Coughlin
Sorry for the formatting.
Coughlin
Does each site have a separate folder or do they point to the same folder? If they point to separate folders then you'll need a .htaccess for each.
Jonathan
They are in their own folders. I will try that. Thanks
Coughlin
I have it in its own folder in the directory and when I try going here: http://www.virtualgiftcardsystem.com/features/ - it doesnt load. Any ideas?
Coughlin
So virtualgiftcardsystem has it's own folder under the root hosting account? You have a .htaccess file in that folder. Silly questions but will ask anyway, you have RewriteEngine on in the .htaccess? Have you check to see that mod_rewrite is installed?
Jonathan
Correct, its vgc/ within the root directory. I use it for my wordpress installation under the root directory and the rewrite works for WordPress. And again to check, it should be in the vgc/ domain folder. Not the root.
Coughlin
This is what I have in my file: http://pastie.org/887523
Coughlin
And that code is to make ?v=page = /page/
Coughlin
Try adding "RewriteBase /" after the line to turn RewriteEngine on, without the " of course.
Jonathan
http://www.virtualgiftcardsystem.com/features/ - still a 404. I have this now: http://pastie.org/887612 - thanks for your help!
Coughlin
Try "RewriteBase /vgc/" - vgc being the name of the sub folder
Jonathan
Same thing, and I checked to make sure GoDaddy allows mod_rewrite and they do. Not sure why it isnt working! Thank you
Coughlin
how about what is suggested here? http://davidwalsh.name/mod_rewrite-htaccess-godaddy
Jonathan