Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have searched a lot and implemented many many Regular Expression in my .htaccess file but can not succeed. How do I find a generic way that make my URL SEO friendly?

Currently this is in my .htaccess file:

   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]

What I need to do is that I have a URL like this:

   http://localhost/abc/index.php?page=boats_for_sale

I need to change it to

  http://localhost/abc/boats_for_sale

Similarly, I want to hide all query strings in my URL. How would I achieve it?

share|improve this question

1 Answer 1

RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1

for detail follow this link

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.