By puntadigital
Hi there I have my site up and running, domain.com and www.domain.com works fine, the redirect works, but if I create a folder domain.com/folder works, but www.domain.com/folder takes me back to the homepage. I’ve checked the htaccess and nothing caught my attention there
Any ideas how to fix that? Sorry for being so basic but all the articles I’ve been reading are mostly chinese for me :(
I have a droplet running Ubuntu 20.04, apache, mysql, php and couple other things in case that helps
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!
Hello, @puntadigital
Could you please confirm that you would like www.domain.com to redirect to domain.com but also to have www.domain.com/folder without redirecting back to domain.com?
If you want to redirect domain.com/folder/ to www.domain.com/folder/ you can use this .htaccess rule:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{REQUEST_URI} ^/folder/
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
Hope that this helps! Regards, Alex
Thank you Alex ! I forgot to mention, looking to simplify the explanation, that “folder” was an example, the folder name is a name the system creates for each registered user, so is dynamic, I have just a few users now, but hope to get more, so I have no idea how to fix that for now and the future. Trying to get a hold of the person that developed the php script I’m using, maybe he can help.
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.