Need help redirect url

I converted my vb4 forum to xf a week ago, thread & forums url redirecting works perfect, I need help in redirection some other urls.
My xf is installed in "" folder, I have php 5.3.3, Apache 2.2.16, Debian squeeze.

1- I want to redirect all www to non-www. I found this in searching here:
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301]
Is it good for my case ?

2- Nothing is installed in my site homepage "", I want to redirect this page to my xenporta page: ----->

3- My old vb4 forum was installed in "" folder, all thread and forums urls redirecting works great, except the vb home page. I want this redirect: ----->

4- I have static content located in "" folder: as a home page for this static content, and,, ... as different pages for that content.
Now I have transferred this content using xf pages system, so I want these redirects: ----------------> ---> --->
.... --->

Thank you.

Jake Bunce

XenForo moderator
Staff member
1) To enforce no "www" in the /community directory, add these two lines to XenForo's .htaccess file in the /community directory:

Rich (BB code):
#	Mod_security can interfere with uploading of content such as attachments. If you
#	cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#	SecFilterEngine Off
#	SecFilterScanPOST Off

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
	RewriteEngine On

	RewriteCond %{HTTP_HOST} !^yoursite\.com$
	RewriteRule ^(.*)$$1 [R=301,L]

	#	If you are having problems with the rewrite rules, remove the "#" from the
	#	line that begins "RewriteBase" below. You will also have to change the path
	#	of the rewrite to reflect the path to your XenForo installation.
	#RewriteBase /xenforo

	#	This line may be needed to enable WebDAV editing with PHP as a CGI.
	#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

	RewriteCond %{REQUEST_FILENAME} -f [OR]
	RewriteCond %{REQUEST_FILENAME} -l [OR]
	RewriteCond %{REQUEST_FILENAME} -d
	RewriteRule ^.*$ - [NC,L]
	RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
	RewriteRule ^.*$ index.php [NC,L]

Jake Bunce

XenForo moderator
Staff member
2) You can upload an "index.php" file to the web root with this:




3) Similar to #2.

4) Use this .htaccess file in the /quran directory:

RewriteEngine On

RewriteRule ^page([0-9]+)\.html$ /community/pages/quran/page$1/ [R=301,L]
RewriteRule ^$ /community/pages/quran/ [R=301,L]
Thank you Jake. That works great.

About the 4th point, page's names are not page1, page2, ... I did that just to explain that there are many pages.
Page's names are like: affasi.html, sudays.html, ... so the redirects shoul be: ---> --->
Please update the last code.
Sorry for that.