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 PostThere are several examples all over the internet. if you just perform a quick search, you'd find them.
here is one example...
RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Jump to Postit may be helpful if show your rule(s).
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\. …
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.