i've done this

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

to make

www.example.com/profile.php?user=testing

into

www.example.com/testing

What i'd like to do is change..

www.example.com/profile.php?user=testing

into

www.example.com/user=testing

What is the RewriteRule to accomplish this? Also if i used $_GET with the second clean url would it still work?

Recommended Answers

All 8 Replies

Try this.

RewriteEngine On
RewriteRule ^user=([^=]*)$ /profile.php?user=$1 [L]
commented: nice +13

nope it don't help, it gives error page

http://www.example.com/username

RewriteRule ^([A-Za-z0-9-\.\]+)$ public.php?user=$1
OR
RewriteRule ^([A-Za-z0-9-\.]+)$ public.php?user=$1

gives error pages and the returning url is like
http://www.example.com/public.php

found the solution here

http://www.generateit.net/mod-rewrite/

RewriteRule ^([^/]*)\.html$ public.php?user=$1 [L]

which write the url as
http://www.example.com/username.html
AND
http://www.example.com/user.name.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.