.htaccess redirect if ANY query string is present?

前端 未结 4 402
抹茶落季
抹茶落季 2021-01-15 02:44

I have the following .htaccess at present.


 suPHP_ConfigPath /home/abc/php.ini


RewriteEngine on
RewriteCond $         


        
4条回答
  •  醉话见心
    2021-01-15 03:32

    I wasn't sure from your description exactly what you were after, so you should keep or remove the second RewriteCond depending on your specific needs.

    RewriteEngine On
    
    # Remove the query string with a redirect
    RewriteCond %{QUERY_SRING} !=""
    # But only if the path ended with a /
    # (remove this to redirect anything with a query string)
    RewriteCond %{REQUEST_URI} /$
    RewriteRule .* /$0? [R=301,L]
    
    # Then perform your internal rewrite
    RewriteCond $1 !^(index\.php|media|css|js|images|robots\.txt)
    RewriteRule ^(.*)$ /index.php/$1 [L]
    

提交回复
热议问题