简体   繁体   中英

How can I redirect a static url to a dynamic one via HTACCESS?

How can I redirect www.domain.com/sitedomain to www.domain.com/dir/directory/sitedomain.htm through htaccess?

Example is:

www.domain.com/google.com -> www.domain.com/dir/directory/google.com.htm

Any easy way to do this?

You can give the following rules a try:

RewriteEngine On
RewriteRule ^([^/]+\.(com|net|info|io|in|cz|org))$ /dir/directory/$1.htm [L,QSA]

You can replace [L with [L,R if you want to redirect users as well. You can add more subdomains to the list above by editing the part (com|net|info|io|in|cz|org) .

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