简体   繁体   中英

redirecting all urls with .cfm files using regex in .htaccess files from .cfm to .php with Query Strings

I need to redirect all urls which ext is .cfm to .php in same file with same requested query sting.

Example : -

From

example.com/index.cfm?queryString=1234

to

example.com/index.php?queryString=1234

urls may or may not have queryStrings.

All website pages with .cfm should redirect to .php.

You can use this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteRule ^(.+?)\.cfm$ /$1.php [L,NC]

If you want full redirect then add R flag above as:

RewriteRule ^(.+?)\.cfm$ /$1.php [L,NC,R]

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