XF 2.1 How to simplify URL of home page and other pages when shared? (Remove 'index' in URL)



When I copy/paste my website URL from the browser address bar to share it on social media, the clickable link looks like this:

How can I make it look like this:

When I copy/paste from the browser address bar to share the URL of a specific page, the clickable link looks like this:

How can I make it look like this:

I want to put that last one as the website URL in my social media profiles. Right now, it returns a 404 - URL not found error. The long address looks clunky.

Checking the box to Use full friendly URLs fixed the main website URL so it looks like this:

but the page URL
returns a 404 not found. (Edit: this is with the route filter ON)

If I leave the friendly URL off and implement a route filter like this:

Find route: pages/where_to_find

Replace with: where_to_find

I still get index.php? in the URL:

Is it safe to show the contents of my .htaccess file here? I think it's the standard one from Xenforo.
Last edited:
Rename the htaccess.txt file on the server to .htaccess.

None of the pages other than the index page are working, so either the .htaccess file is missing, or the server doesn't support it.
Check the contents of the .htaccess file.

It should look like this:
#    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 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

    #    This line may be needed to workaround HTTP Basic auth issues when using 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]

If it is, then disable the FURLs and contact your host and get them to configure the server to support it.
I got it to work by adding the code in Brogan's post above to the existing code in the .htaccess file and adding the route filter. The existing code is necessary to implement the SSL certificate, according to A2 Hosting support.

However, now all the image links in this page are broken:

In the code for the page, the code for each image is like this:

<img src="styles/default/images/175x280_coolhunter_red_streaks.png" />

Edit: Disabling the route filter doesn't solve the broken path to the images.

So I'm guessing the FURL is somehow breaking the path to the image. How do I fix that?
Last edited:
It should be: /styles/default/images/175x280_coolhunter_red_streaks.png

Note the / at the start.

However, if you embedding images, you would typically use the absolute URL, not a relative one.
Top Bottom