user3032273
user3032273

Reputation: 7

Remove directory structure from URL using .htaccess

My website URL is currently like this:

I want to change it into this:

I tried the following code in my .htaccess file but it is not working.

Options +FollowSymLinks
RewriteEngine on
RewriteRule http://ori123.com/rock-rotary-smart-case-series-for-ipad-air/(.*)/$ /product/detail/128/rock-rotary-smart-case-series-for-ipad-air?$1=

Can somebody tell me how can I do this using .htaccess?

Upvotes: 0

Views: 58

Answers (1)

anubhava
anubhava

Reputation: 786091

You only match REQUEST_URI in RewriteRule without protocol and domain name. Use this rule:

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^rock-rotary-smart-case-series-for-ipad-air/(.*?)/?$ /product/detail/128/rock-rotary-smart-case-series-for-ipad-air?$1 [L]

Upvotes: 1

Related Questions