0

My url is http://example.com/product/Braided/table-fan

And i want to rewrite like this http://example.com/Braided/table-fan

where product is my php file.

Current rules:

Options +MultiViews +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^([0-9a-zA-Z]+)/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ product/$1/$2/$3
RewriteRule ^([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ product.php?uname=$1&pid$2
Abhishek Gurjar
  • 7,426
  • 10
  • 37
  • 45
  • Possible duplicate of [In .htaccess remove word from URL](http://stackoverflow.com/questions/10839047/in-htaccess-remove-word-from-url) – Abhishek Gurjar Mar 30 '17 at 09:52
  • you mean RewriteRule ^product/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ product.php?uname=$1&pid$2 to RewriteRule ^([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ product.php?uname=$1&pid$2 – Shailendra Gupta Mar 30 '17 at 09:54
  • Options +MultiViews +FollowSymLinks Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #RewriteRule ^([0-9a-zA-Z]+)/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ product/$1/$2/$3 RewriteRule ^([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ product.php?uname=$1&pid$2 – Shailendra Gupta Mar 30 '17 at 09:56

1 Answers1

0

Try and use this in your root .htaccess:

RewriteEngine On
RewriteRule ^$ product/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ product/$1

This should remove product from your URL and leave you with: http://example.com/Braided/table-fan.

Make sure you clear your cache before testing this.

Joe
  • 4,877
  • 5
  • 30
  • 51