1

This is a line of code on my htaccess file

RewriteRule ^([^\.]+)$ details.php

And this is working fine with this URL

example.com/shiv-sales-corporation

Now i want to add .html at the end of URL

example.com/shiv-sales-corporation.html

I have changed my htaccess code with this

RewriteRule ^([^\.]+)\.html$ view_details.php

but the other pages or links are conflicting after it, kindly help me please!

Note: "shiv-sales-corporation" is a slug which i fetching it from the database, it changed randomly by other link on page. Examples:

example.com/ibm

example.com/apple-corp

example.com/himalaya-ltd
Jassi Oberoi
  • 1,424
  • 1
  • 12
  • 25
Pawan Arya
  • 19
  • 3

3 Answers3

0

Hope this will work for you:

RewriteRule ^([^\.]+)([\.html]*)$ view_details.php

I am assuming that you want to redirect to view_details.php each time the URLs you listed are accesed. No matter if .html is present or not.

Hariprasad
  • 3,556
  • 2
  • 24
  • 40
  • Yes but your code is still giving the same issue. it's only configuring the .html and redirecting all the html link to details.php – Pawan Arya May 20 '13 at 07:45
  • Check here: http://htaccess.madewithlove.be/ It works here. You can also try this: `RewriteRule ^([^\.]+)([\.html])*$ view_details.php` Hope this tool will help :) – Hariprasad May 20 '13 at 07:48
  • RewriteRule ([a-zA-Z0-9_+-]+)\/products\.html products.php Now this kind of RewriteRule is not working, all the .html url going to view_details.php – Pawan Arya May 20 '13 at 10:00
  • Add this rule: `RewriteRule ^([^\.]+)([products\.html]*)$ products.php` – Hariprasad May 20 '13 at 10:08
0

Click to More

RewriteRule ^(.*).html$ $1 [R=301,L]

Saurabh Chandra Patel
  • 12,712
  • 6
  • 88
  • 78
-1
RewriteEngine On
RewriteRule ^([^/]*)\.html$ /details.php?name=$1 [L]

where name is your dynamic parameter coming from database

Manish Jangir
  • 505
  • 3
  • 9