WBB 4.1 and HTTP 404 error

  • I'm doing tests and I just saw that www.domain.com/test not generates HTTP 404 error but www.domain.com/test/ yes generates (the / is the diference). Is it a bug? I need to configure something?

    Thanks.

    Edit.

    www.domain.com/?test and www.domain.com/?test/ yes generates HTTP 404 error. Is Enable URL-Rewrite option the problem?

    6 Mal editiert, zuletzt von Aethior (15. Februar 2015 um 18:53)

  • do you have a .htaccess file with mod_rewrite rules?

    I have this .htaccess:


    Apache Configuration
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([a-z]+)/([^/]+/)?$ index.php?$1/$2 [L,QSA]
    </IfModule>
  • Try editing out RewriteBase and see what happens. You only need use that if your server doesn't do it itself proper, which most do and isn't usually needed enabled in htaccess files. See if doing this makes any difference.

    Apache Configuration
    <IfModule mod_rewrite.c>
    RewriteEngine On
    # RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([a-z]+)/([^/]+/)?$ index.php?$1/$2 [L,QSA]
    </IfModule>
  • Try editing out RewriteBase and see what happens. You only need use that if your server doesn't do it itself proper, which most do and isn't usually needed enabled in htaccess files. See if doing this makes any difference.

    Apache Configuration
    <IfModule mod_rewrite.c>
    RewriteEngine On
    # RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([a-z]+)/([^/]+/)?$ index.php?$1/$2 [L,QSA]
    </IfModule>


    Hi @GTB'

    With this code the URLs do not work. :/

  • Hmm. I just tried doing same on my localhost using htaccess same as yours

    If I enter /test it shows 404 page. If I enter /test/. it shows me a forum page with a red bar saying "The link you are trying to reach is no longer available or invalid".

    If I enter /?test and /?test/. Both show me a forum page with "The link you are trying to reach is no longer available or invalid".

  • Hmm. I just tried doing same on my localhost using htaccess same as yours


    If I enter /test it shows 404 page. If I enter /test/. it shows me a forum page with a red bar saying "The link you are trying to reach is no longer available or invalid".

    I think in my post I explained wrong.

    Yes, the same happens in my forum. I can create a 404 custom page, but I think the perfect solution is that the forum displays his 404 with The link you are trying to reach is no longer available or invalid, no?

  • Code
    ^([a-z-]+)/([^/]+/)?$

    Makes no difference doing that for me. Using "/?test, /?test/, /test/". All 3 lead to a forum page saying that message mentioned before. But using "/test". Leads to a 404 server error page shown

  • Use the pattern ^([a-z-]+)/([^/]+/)?$ (note the added dash - in the first group)

    Apache Configuration
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([a-z-]+)/([^/]+/)?$ index.php?$1/$2 [L,QSA]
    </IfModule>

    This? The same happens, no difference.

  • @Aethior I guess I missed your point, you want example.com/test to be actually matched and then handled by the software? In that case use ^([a-z-]+)(/[^/]+/)?$ which causes URLs to match without a trailing slash.

    Hi @Alexander Ebert,

    If you try to visit www.domain.com/?test or www.domain.com/?test the software generate a 404 page with The link you are trying to reach is no longer available or invalid message.

    But when you have Enable URL-Rewrite option activated, www.domain.com/test/ generates a 404 page error with this message but www.domain.com/?test (without /) no.

  • Code
    ^([a-z-]+)(/[^/]+/)?$

    Doing that now has the opposite affect of making anything with a trailer slash lead to a 404 Server Error page now. Before using your change it showed a forum page for it

    It fixes "/test" without a trailing slash like you said. But then it also now makes having a trailer slash "/test/" not work anymore (which it did before) showing a forum page for it

    Einmal editiert, zuletzt von Macondiana (15. Februar 2015 um 21:26)

  • Duh, I just wrote it down quickly, this one should do it: ^([a-z-]+)(?:/([^/]+/)?)?$

    That works testing.

    1. /test
    2. /test/
    3. /?test
    4. /?test/

    All now show a forum error page

    So for anyone reading running forum only install they should be using this now as htaccess file.

    Apache Configuration
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([a-z-]+)(?:/([^/]+/)?)?$ index.php?$1/$2 [L,QSA]
    </IfModule>
  • Now the correct htaccess is...

    Apache Configuration
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([a-z-]+)(?:/([^/]+/)?)?$ index.php?$1/$2 [L,QSA]
    </IfModule>
  • That is odd because same thing happens for me. But a topic works fine with numbers such as this posted on my forum.

    Code
    http://localhost/thread/37-when-a-member-turns-from-being-a-good-poster-into-an-obvious-troll/

    Oh, I get what you are trying to say but there is never numbers included with thread "/thread/" though. It is always just thread

    All these will do same.

    1. /100-thread
    2. /100-thread/
    3. /thread-100
    4. /thread-100/

    They all give server error page

    2 Mal editiert, zuletzt von Macondiana (15. Februar 2015 um 22:29)

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!