By Eric
Goal: have www.website.com/anything redirect to www.website.com Issue: 404
I’ve meticulously followed: https://www.digitalocean.com/community/questions/htaccess-and-subdomain-issues
Confirmed: Activate Mod_Rewrite ✓ Create new .htaccess file ✓ Allow use of .htaccess ✓ Restart Server every change ✓
My current .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /
Misc. Fun Facts:
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!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I am facing same issues, and not able to get any resolution. please share, how you fixed this issue.
Hi,
What I could suggest is first to make sure that your .htaccess file actually works. You could try causing a 500 error by adding some random characters on top of the file (Example: just pot asd on the first line of the .htaccess file and save it) then try accessing your site, if you get a 500 error then you would know that the .htaccess file actually works.
If this is the case, you could try modifying your redirect rule a little bit:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /index.html [L]
If the .htaccess file is not working you would need to check your Apache config again.
Hope that this helps! Bobby
#.htaccess file to redirect all non-existent paths and files to "/index.php"
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA]
</IfModule>
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.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
