XF 2.0 .htaccess file edit

Justwise

Member
I have my xenforo installed on www.example.com (my root folder) and I wanna move it to a new subdirectory so it will be www.example.com/community then install my Xenpress in my root folder. @Brogan My question is- from where will I edit the .htaccess file? Is it somewhere on my XF ACP?
and where in the .htaccess file will I paste the code on number 5 in the FAQ?
@SyTry

Pls someone help a brother
 
The .htaccess is located in the same directory add your XF files. You would add it after the default XenForo rewrite rules that are present in the file.
 
Last edited:
thanks @ozzy47 but it still didn't work. I changed the Board URL in my XF ACP before moving the files to the community subdirectory, and then I pasted the rewrite rule in my .htaccess file. Take a look at my .htaccess file
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>
RewriteEngine On

# 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

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]
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/$
RewriteRule (.*) /community/ [R=301]

But it still didn't work. Where do you think I,m getting it wrong??

@Brogan your help will be much appreciated. :(
 
You moved from the root to /community, then you need this in your .htaccess

Code:
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/$
RewriteRule (.*) /community/ [R=301]
not the one you used.
 
Then that suggests that your XF files are not in the /community location.
Bro I do much appreciate your help. The thing is /community folder was outside public_html before so I moved it inside Public_html and then it worked. I think subdirectories should always be outside the root folder right? Or is this how it’s supposed to be?
C4074E16-586A-45BE-9B65-82F7FFD50BE7.webp
 
No, it should be inside the public_html, that is the root directory. Glad it is working now. (y)
Thank you so much. But lastly I tried removing the rewrite rule from the htaccess file just to see if I will get the 404 errors but I didn’t. it was still loading /community. Is this just gonna affect the indexed pages on search engines?
 
Yes, the rewrite rule is for redirecting the old links to the new /community directory, it is best to leave that in place so search engines do not get any 404 errors.
 
Top Bottom