.htaccess issues.

Hello, i am having a bit of trouble with .htaccess rewrites - i was just wondering if anyone can shed some light on it… currently i have:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?profile=$1

So it checks if its a file or directory … then it rewrites the url get variable with the name added.

What im wanting to do is just dothings like…

if i put “website.com/profilename” it would take me to the profile (index.php?profile=profilename)

(that part works already) although if i put

website.com/profilename/pagename” it would take me to (index.php?profile=profilename&page=pagename)

How would you recommend me doing this… building up seperate directories??

Thanks
Lewis

Save the hassle, use a generator: http://www.generateit.net/mod-rewrite/index.php

Have tried, but somethings wrong as its not working… “The requested URL /wiveliscombe.football.club/ was not found on this server.”

I also see that in the rewrite… it seems to add the index.php and remove the url…


Actually that seems to work… if you clear cache and load page from scratch… if you make change to the primary address after… it doesnt seem to have any updated effects.

Thankyou for your help - although is there a way where i dont need all the variables… so i can just do
website.com/wiveliscombe.football.club/

RewriteEngine On
RewriteRule ^([^/])/([^/])/([^/]*)$ /index.php?vanity_profile=$1&page=$2&post=$3 [L]

The variable i need to keep is the vanity profile variable. So that they can view the profile even without the page and post variables in place.

Just change the parameter to none in the generator for the items you don’t want.

Sponsor our Newsletter | Privacy Policy | Terms of Service