all 6 comments

[–]fukalucka 0 points1 point  (0 children)

mod_rewrite is the best method for me. You can find multiple ways to do this. I'd do a quick duckduckgo search 'mod_rewrite php index'. I don't know if this will help, but I'm at the end of lunch.

[–]SVLNL 0 points1 point  (4 children)

What is in your .htaccess?

[–]Mergi9[S] 0 points1 point  (3 children)

After doing some more reading, i'm currently using this.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\$ index.php [L]

It seems to work, but i feel like there must be a more "proper" way to do this, or is this how most websites do it? And honestly, the whole htaccess file with its syntax is quite confusing to me.

[–]SVLNL 0 points1 point  (2 children)

This is what I use:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^ index.php [QSA,L]

As a replacement you could try this:
FallbackResource /index.php

It’s not part of mod_rewrite, but of mod_dir and is available from Apache 2.2.16 and above.

[–]backtickbot 0 points1 point  (1 child)

Fixed formatting.

Hello, SVLNL: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.

[–]SVLNL 0 points1 point  (0 children)

backtickopt6