3

I tried to re-write on my own but unable to do so, basically, I want to re-write php-based URL with .htaccess but also need to skip few parameters of php URL for example;

Original URL: http://example.com/details.php?id=62?title=billions-s01e09-webrip-x264-fumettv

Required Format: http://example.com/billions-s01e09-webrip-x264-fumettv-id62.html

Format Sequence: MySiteURL/Title-of-Post-PostID.html

Looking for kind response, please guide me how can i make this possible through .htaccess. waiting for kind response... Good day

2 Answers2

2

As you already know that you have to change the .htaccess file in your server. You can use regx to achieve your required url. Using the following code can help you.

RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([a-zA-Z0-9-]+)-id([0-9]+).html?$ details.php?id=$2&title=$1 [QSA,L]

worked fine for me. Hope will work for you too.

Amit Sarwara
  • 573
  • 7
  • 15
1

To rewrite

to

You can use the following rule :

RewriteEngine on


RewriteRule ^([^-]+)-id([0-9]+)\.html$ /details.php?id=$2?title=$1 [NC,L]
Amit Verma
  • 40,709
  • 21
  • 93
  • 115
  • Thanks "starkeen" for your answer but you share rule to convert .html link into php but i requested to guide me how to write .php url into html as quoted in my question, mate – orichec1000 Jun 09 '16 at 06:39
  • Sorry, i forgot to add **.html** to the pattern. Anyway try the updated rule. – Amit Verma Jun 09 '16 at 07:46