XF 2 Tip [TUTORIAL] How to remove index.php in xenforo forums. 100% Working Tested By Me

ShieldX

Well-known member
Registered
Joined
Mar 27, 2022
Messages
453
Points
53

Reputation:

Just find .htaccess file and paste the code inside it .

Code:
ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>
    RewriteEngine On

    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]

</IfModule>

Then save that file.

Now you can proceed into your Admin CP.
Go into "Options", then go to "Basic board information", then scroll to the bottom and check "Use full friendly URL's".

Now if you did it right, your index.php should be removed from the URL. Go to your site to confirm this.
 

one_finger_man

Well-known member
Registered
Joined
Jan 20, 2022
Messages
385
Points
53

Reputation:

this you can use like this just remove the # and it will work 100%


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
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
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 /

    #    This line may be needed to workaround HTTP Basic auth issues when using PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
    #   Uncomment those 3 lines bellow to automatically redirect from "http" to "https" and remove "www" if needed
    #   remember to replace domain.com with your own domain name.   
    #RewriteCond %{HTTPS} off [OR]
    #RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
    #RewriteRule (.*) https://domain.com/$1 [L,R=301]

    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]
</IfModule>
 
Top