简体   繁体   中英

Redirect all URLs without `www.`

I'm using below .htaccess code to add www to all URLs without www, on my current server it's working fine but since I changed my hosting to godaddy there is a problem as images on my website are not loading! When I'm removing this htaccess file then everything is fine.

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www.zire20.ir$ [NC]
RewriteRule ^(.*)$ http://www.zire20.ir/$1 [L,R=301]

RewriteRule ^([^/]*)/([^/]*)$ /view_basket.php?order_id=$1&pin=$2 [L]

You should probably change your rule to the following, and add the condition to ensure files don't get rewritten:

# Make sure the request doesn't point to a file first
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^([^/]+)/([^/]+)$ /view_basket.php?order_id=$1&pin=$2 [L]

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