Redirect dynamic url to static url using htaccess

0

If you want to redirect bulk of dynamic url to specific / static url, it can do using htaccess file.Here is a example to redirect dynamic urls to specific url using htaccess file.

Think, you have following type of dynamic urls.

http://example.com/category-1/sample-1/details.xml
http://example.com/category-1/sample-2/details.xml
http://example.com/category-3/data/details.xml

In here, example.com and details.xml are static content.category-1,category-3,data…etc dynamic contents.

How to redirect all of above dynamic url to following like static url?
http://example.com/details.xml

How to redirect dynamic url to static url?

Simply put the following script into the htaccess file.


RedirectMatch ^/.+/details.xml$ /details.xml

This is a permanent redirect process named as “301” redirect. So this is not effect to the SEO rank of the site.

Share.

About Author

Sumith Harshan is the Web Engineer Specializes in Java Script, JQuery, HTML4/5, CSS2/3, PHP, CodeIgniter, CakePHP, J2SE, J2EE, XML, Hacking & Security, Mobile Interface Developing, Magento, Wordpress, Joomla, Drupal,PHPBB,Facebook App Developing and Open cart...etc.