I have a project where everything on the website is routed via index.php and the way my app is designed, index.php can be removed from the URL safely. So, /index.php/inbox?from=23 can safely be converted to /inbox?from=23.
I need the rewrite rule (Apache 2.4) for doing so. There is a constraint though - I do not want to do it via .htaccess file, but from the host configuration file (/etc/apache2/sites-available/000-default.conf) only. On my development machine, I have the following:
<IfModule mod_rewrite.c>
# Rules to serve URLs which point to files directly
# ----------
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
But this is not working on the server. (I know that RewriteBase is not allowed in the configuration file itself, but removing it does not work either).
What should I do?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
my first website of url in no index.php butt my secound and third website off url index.php problem please help
The url of my first website is not index.php but how do I remove index.php in the URL of the second and third website.
Hi!
Because you have an <IfModule ..> tag, Apache will completely skip over that block if the Rewrite module is disabled without showing any errors or messages in the logs. Enable the module and restart Apache:
sudo a2enmod rewrite
sudo service apache2 restart
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.