0

I was working on a clients site and after trying to add redirects from www to non-www the site unfortunately broke.

I reverted back to the old .htaccess file and it is still not working.

I looked through many threads and tried removing slashes from index.php, and adding/removing rewrite base /, but still no luck.

My last lines of code in the htaccess file are

# Removes index.php
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

I tried changing the last rewrite rule to index.php/$1, index.php?/$1 and /index.php?/$1 from suggestions in other threads but still no luck.

I get a 'NOT FOUND' on the non-www version of the site now, and www. version of the site doesnt load any css,js, or image files.

Has anybdoy experienced anything similar or has any suggestions? Any help would be greatly appreciated

2 Answers 2

1

I'd like to say thanks to pixeldev for pointing me in the right direction in solving my issue.

Turns out it was a DNS issue. I initially tried adding in URL redirects through register.com's UI and it reset my A records to default IP addresses for *.example.com and example.com, but left www.example.com as normal.

Since my CSS, JS, and images were being served through my non-www links, that is why the page was 'NOT FOUND' and none of the content was being served.

After reverting the A records and waiting for changes to propagate, everything is back to normal now.

0

I noticed that your rewrite rule does not include css and js. Do adding them help?

RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
5
  • Thank you for your suggestion! No adding in css and js didn't help. The images don't load either actually. I noticed that the linked scripts and stylesheets in header work if I change the url to www from non-www in inspect dev tools. The whole non-www site is 'NOT FOUND' on any page and I don't think it is a DNS problem after looking over
    – Fox
    Jul 7, 2017 at 2:43
  • Sounds like a possible issue with your DNS. I'd double check the A/cname records to be sure
    – pixldev
    Jul 7, 2017 at 3:37
  • Looks like it is potentially a DNS error, the A records got set to default after I tried adding DNS level redirects at first. Waiting for changes to propagate back to normal and will post an update then... embarrassing ha. Thanks for all your help and pointers, very much appreciated.
    – Fox
    Jul 7, 2017 at 13:50
  • Glad to hear you've got a solution. Please be sure to post an answer when you've resolved it. I'm sure others will benefit from it in the future as it's very easy to overlook DNS.
    – pixldev
    Jul 7, 2017 at 14:16
  • Changes have been propagated and everything is back to normal. As you pointed out, it was a DNS issue. Updating the answer and thanks for the pointer
    – Fox
    Jul 7, 2017 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.