UPDATE: The assumptions made here are wrong so this answer is mostly irrelevant now. This answer is just for future reference.
We're going to have to make some assumptions to answer this...
/www/html
is your document root and therefore /forum
is a subdirectory, off the document root in which this .htaccess
file is located.
- All requests should be relative to the
/forum
subdirectory. (Which I assume is why this .htaccess
file is in the /forum
subdirectory.)
Try changing your directives to the following:
RewriteEngine On
RewriteBase /forum
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(jpeg|jpg|gif|png)$ public/404.php [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Note that I've changed the RewriteBase
directive and made both RewriteRule
substitutions relative (ie. no slash prefix).
instead of looking like example.com/index.php?user=222
it would look like example.com/user/222
.
I'm assuming that everything is in the /forum
subdirectory, so this would need to be present in both these URLs: example.com/forum/index.php?user=222
and example.com/forum/user/222
respectively. You would only be able to remove the /forum
subdirectory from the URL if this .htaccess
file was in the document root. (If a request of the form example.com/index.php?user=222
worked successfully then "something else" is going on here.)
This worked fine back on my old centos 6.8 but on 7 all it does is to display the Apache test page
I don't really see how this could have worked on your "old centos 6.8", unless you had a different directory structure and this was all in the document root and not a subdirectory?
I can only assume that the "Apache text page" is index.php
in the document root? Otherwise, where is this located?