Not Solved [Performance] Non-WWW to WWW htaccess
#1
Not Solved
Hi, I try to add this in the .htaccess file:

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

for redirect, non-www to www, my forum. It's work, but all stylesheets not working.

This is my .htaccess file:

Options -MultiViews +FollowSymlinks -Indexes

<IfModule mod_security.c>
	# Turn off mod_security filtering.
	SecFilterEngine Off

	# The below probably isn't needed, but better safe than sorry.
	SecFilterScanPOST Off
</IfModule>

<IfModule mod_rewrite.c>
	RewriteEngine on

	# Some hosts require RewriteBase to make RewriteRules work.
	RewriteBase /community/

	# Google SEO workaround for search.php highlights:
	# Make this rule the first rewrite rule in your .htaccess!
	RewriteRule ^([^&]*)&(.*)$ http://website.net/community/$1?$2 [L,QSA,R=301]

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

	# Google SEO 404:
	ErrorDocument 404 /community/misc.php?google_seo_error=404

	# Google SEO Sitemap:
	RewriteRule ^sitemap\-([^./]+)\.xml$ misc.php?google_seo_sitemap=$1 [L,QSA,NC]

	# Google SEO URL Forums:
	RewriteRule ^f\-([^./]+)$ forumdisplay.php?google_seo_forum=$1 [L,QSA,NC]

	# Google SEO URL Threads:
	RewriteRule ^t\-([^./]+)$ showthread.php?google_seo_thread=$1 [L,QSA,NC]

	# Google SEO URL Announcements:
	RewriteRule ^a\-([^./]+)$ announcements.php?google_seo_announcement=$1 [L,QSA,NC]

	# Google SEO URL Users:
	RewriteRule ^u\-([^./]+)$ member.php?action=profile&google_seo_user=$1 [L,QSA,NC]

	# Google SEO URL Calendars:
	RewriteRule ^c\-([^./]+)$ calendar.php?google_seo_calendar=$1 [L,QSA,NC]

	# Google SEO URL Events:
	RewriteRule ^e\-([^./]+)$ calendar.php?action=event&google_seo_event=$1 [L,QSA,NC]

	# Default MyBB Rewrite Rules:
	RewriteRule ^forum-([0-9]+)\.html$ forumdisplay.php?fid=$1 [L,QSA]
	RewriteRule ^forum-([0-9]+)-page-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2 [L,QSA]

	RewriteRule ^thread-([0-9]+)\.html$ showthread.php?tid=$1 [L,QSA]
	RewriteRule ^thread-([0-9]+)-page-([0-9]+)\.html$ showthread.php?tid=$1&page=$2 [L,QSA]
	RewriteRule ^thread-([0-9]+)-lastpost\.html$ showthread.php?tid=$1&action=lastpost [L,QSA]
	RewriteRule ^thread-([0-9]+)-nextnewest\.html$ showthread.php?tid=$1&action=nextnewest [L,QSA]
	RewriteRule ^thread-([0-9]+)-nextoldest\.html$ showthread.php?tid=$1&action=nextoldest [L,QSA]
	RewriteRule ^thread-([0-9]+)-newpost\.html$ showthread.php?tid=$1&action=newpost [L,QSA]
	RewriteRule ^thread-([0-9]+)-post-([0-9]+)\.html$ showthread.php?tid=$1&pid=$2 [L,QSA]

	RewriteRule ^post-([0-9]+)\.html$ showthread.php?pid=$1 [L,QSA]

	RewriteRule ^announcement-([0-9]+)\.html$ announcements.php?aid=$1 [L,QSA]

	RewriteRule ^user-([0-9]+)\.html$ member.php?action=profile&uid=$1 [L,QSA]

	RewriteRule ^calendar-([0-9]+)\.html$ calendar.php?calendar=$1 [L,QSA]
	RewriteRule ^calendar-([0-9]+)-year-([0-9]+)\.html$ calendar.php?action=yearview&calendar=$1&year=$2 [L,QSA]
	RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ calendar.php?calendar=$1&year=$2&month=$3 [L,QSA]
	RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4 [L,QSA]
	RewriteRule ^calendar-([0-9]+)-week-(n?[0-9]+)\.html$ calendar.php?action=weekview&calendar=$1&week=$2 [L,QSA]

	RewriteRule ^event-([0-9]+)\.html$ calendar.php?action=event&eid=$1 [L,QSA]

	<IfModule mod_env.c>
		SetEnv SEO_SUPPORT 1
	</IfModule>
</IfModule>

# GZIP Compression
<IfModule mod_deflate.c>
	# Comprime HTML, CSS, JavaScript, Text, XML e fonts
	AddOutputFilterByType DEFLATE application/javascript
	AddOutputFilterByType DEFLATE application/rss+xml
	AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
	AddOutputFilterByType DEFLATE application/x-font
	AddOutputFilterByType DEFLATE application/x-font-opentype
	AddOutputFilterByType DEFLATE application/x-font-otf
	AddOutputFilterByType DEFLATE application/x-font-truetype
	AddOutputFilterByType DEFLATE application/x-font-ttf
	AddOutputFilterByType DEFLATE application/x-javascript
	AddOutputFilterByType DEFLATE application/xhtml+xml
	AddOutputFilterByType DEFLATE application/xml
	AddOutputFilterByType DEFLATE font/opentype
	AddOutputFilterByType DEFLATE font/otf
	AddOutputFilterByType DEFLATE font/ttf
	AddOutputFilterByType DEFLATE image/svg+xml
	AddOutputFilterByType DEFLATE image/x-icon
	AddOutputFilterByType DEFLATE text/css
	AddOutputFilterByType DEFLATE text/html
	AddOutputFilterByType DEFLATE text/javascript
	AddOutputFilterByType DEFLATE text/plain
	AddOutputFilterByType DEFLATE text/xml

	# Rimuove bug dei browser (per browser molto vecchi)
	BrowserMatch ^Mozilla/4 gzip-only-text/html
	BrowserMatch ^Mozilla/4\.0[678] no-gzip
	BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
	Header append Vary User-Agent
</IfModule>

# Leverage Browser Caching
<ifModule mod_headers.c>
	<filesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
		Header set Cache-Control "max-age=2592000, public"
	</filesMatch>

	<filesMatch "\\.(css)$">
		Header set Cache-Control "max-age=604800, public"
	</filesMatch>

	<filesMatch "\\.(js)$">
		Header set Cache-Control "max-age=216000, private"
	</filesMatch>

	<filesMatch "\\.(xml|txt)$">
		Header set Cache-Control "max-age=216000, public, must-revalidate"
	</filesMatch>

	<filesMatch "\\.(html|htm|php)$">
		Header set Cache-Control "max-age=1, private, must-revalidate"
	</filesMatch>
</ifModule>

Regards and Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)