How to redirecting non-www to www with .htaccess for all page's? in my main page(index) works, but if i go mywebsite.com/page2, will not redirect me to my preference domain www.mywebsite.com/page2. How can i fix it?
cristian.stilpeanu.1_1 0 Light Poster
Recommended Answers
Jump to Postthe $1 parameter passes everything after .com to the rewritten url
it should work
except when something is missed or changed on the server config.
many servers are locked down, and if the locking is . .. . less than perfect . ..
tryRewriteCond %{HTTP_HOST} !^www\. …
Jump to Postthen its not an apache config error
your code is not goodline 4, there should not be a nocase [NC] flag it should be L,
rewrite condition in line 3 creates an infinite loop
search for mysite.com in the host string, redirect to www
then do it again to …
Jump to PostOptions +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} !^www\. RewriteRule (.*) http://www.site/$1 [R=301,L]
All 12 Replies
JorgeM 958 Problem Solver Team Colleague Featured Poster
cristian.stilpeanu.1_1 0 Light Poster
JorgeM 958 Problem Solver Team Colleague Featured Poster
almostbob 866 Retired: passive income ROCKS
cristian.stilpeanu.1_1 0 Light Poster
almostbob 866 Retired: passive income ROCKS
cristian.stilpeanu.1_1 0 Light Poster
almostbob 866 Retired: passive income ROCKS
cristian.stilpeanu.1_1 0 Light Poster
almostbob 866 Retired: passive income ROCKS
cristian.stilpeanu.1_1 0 Light Poster
cristian.stilpeanu.1_1 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.