Mod rewrite question

Hello forums

I Have this rule on my htacces

RewriteRule ^news/([A-Za-z0-9-]+)/?$ index.php?page=news&perma=$1 [NC,L]

w/c will rewrite all

to

Question :

how do I edit the rule so I can have
www.site.com/profile.php?perma=mike-portnoy

to
www.site.com/mike-portnoy

I tried
RewriteRule ^/([A-Za-z0-9-]+)/?$ profile.php?perma=$1 [NC,L]
but it doesn’t work

Any ideas? Thanks

Try

RewriteRule ^([A-Za-z0-9-]+)/?$ profile.php?perma=$1 [NC,L]

This is really not a good idea. Any file access attempt on your server that doesn’t match the previous rules (news, articles etc) will go to your username htaccess rule and will be passed over your user profiles file. It’s just not practical. Why isn’t this good?

www.suite.com/user/mike-portnoy

@guido2004 OMG you just removed the “/” Jeez! you rule! Thanks

@kneeko yes that is good but my pesky client wants it the other way, he even suggested I make a function to create a directory everytime a user registers and create all the files needed to display the profile page Jeez (LOL) he just couldn’t dig the concept of dynamic pages.

Thanks sitepoint!

You’re welcome :slight_smile:
And clients shouldn’t have a say in the technical solutions if they don’t know what they’re talking about :wink:

These clients are dangerous to themselves. Sure, the web developers must really pay attention to what the client really needs but some requests are suicidal in long term so unless the pay is extremely rewarding… at some point you should decide if you really want to go on with it or simply quit the project. I wouldn’t even add such a website to my portfolio in case I would accept such client requests.