Jay
Jay

Reputation: 89

htaccess change url strings to simple slug

This is my current url

https://www.example.com/content.php?q=1&s=title-sample-slug

I need to change above url using this type url

https://www.example.com/title-sample-slug

how can i do it using htaccess file. Need to hide the content.php?q=1&s= from url in the browser.

Upvotes: 0

Views: 265

Answers (2)

Jay
Jay

Reputation: 89

This is correct answer for my question

RewriteCond %{QUERY_STRING} q=([0-9a-zA-Z_-]+)&s=([0-9a-zA-Z_-]+) 
RewriteRule content.php %2 [L,QSD]

Upvotes: 1

R. Martin
R. Martin

Reputation: 411

RewriteCond %{QUERY_STRING} q=1&s=(.+) 
RewriteRule content.php %1 [L]

Upvotes: 1

Related Questions