简体   繁体   中英

Redirect based on part of url

How do I do an apache redirect to a startic splash page based on a dynamic url. Part of the url is always static. For example, http://buy.domain.com/product/product1-name-here
What do I need to do if I want to redirected everything that comes in http://buy.domain.com/product/ * to a certain page?

Just try this simple rule in .htaccess file:

RewriteEngine on
Options +FollowSymlinks -MultiViews

RewriteRule ^product/.*$ /yourSplashPage? [R,L,NC]

在您的.htaccess文件中,创建一个Apache RewriteRule以根据正则表达式有选择地选择链接。

RewriteRule ^product/.*$ /certainPage.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