1

I want to make pretty url out of:

 http://www.example.com/search-destroy?id=nameOfCharacter

I have this mod_rewrite:

 RewriteRule ^search-destroy/([^/]*)$ /search-destroy?id=$1 [L,QSA]

That generates this urL:

 http://www.example.com/search-destroy/nameOfCharacter.php

I want to leave out the .php extension here, how would the mod_rewrite look?

Cœur
  • 37,241
  • 25
  • 195
  • 267
sdfgg45
  • 1,232
  • 4
  • 22
  • 42

1 Answers1

1

In a similar situation, i have done something as shown below

<IfModule mod_rewrite.c>
        RewriteEngine On  
        RewriteRule ^search_destroy/([^/.]+)?$ your_php.php?search_destroy=$1 [L]
</IfModule>

There is some changes.

1) one common php script - "your_php.php"

and in your_php.php - you should handle it as shown below

if(isset($_GET['search_destroy'])) {
   // YOUR CODE BASED ON YOUR DYNAMIC id

}

Hope this helps you

Thanks

Oxi
  • 2,918
  • 17
  • 28