简体   繁体   中英

Rewrite Rule using htaccess

I want redirect the following URLs in different URLs. Kindly help me.

First URL:

http://localhost/magento2-ce/images/ Redirect to http://localhost/magento2-ce/

Second URL:

http://localhost/magento2-ce/images/9781601525871/ Redirect to http://localhost/magento2-ce//book/landing/detailedview?itemcode=9781601525871J

What i did?

I tried below solution for second URL working fine.

RewriteRule ^images/([0-9]+)/ http://localhost/magento2-ce/book/landing/detailedview?itemcode=$1J [R=301,NC,L]

But, above Rewrite Rule not working, when i apply below rule for First URL redirect.

RewriteRule ^images/  http://localhost/magento2-ce/ [R=301,NC,L]

Have you tried removing the L (last) flag from one or both rules? https://httpd.apache.org/docs/2.4/rewrite/flags.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM