Answer the question
In order to leave comments, you need to log in
I don't understand why htaccess is not working?
Made a small .htaccess file,
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^[^www\.].*$ [NC]
RewriteRule ^/?([a-z0-9\-]+)/?$ /index.php?item=$1 [NC,L]
Makes a redirect from www to without www and sends everything after the domain to index.php?item=
But there is one caveat, a dot can still be indicated there, I do it like this ^/?([a-z0-9\-\.] +)/?$
But the server gives a 500 error
What could be wrong?
Answer the question
In order to leave comments, you need to log in
When adding a dot - index.php also falls under the rule and the redirect is endless.
To avoid this, they usually add a condition that prohibits the execution of the rule if the requested file actually exists:RewriteCond %{REQUEST_FILENAME} !-f
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question