e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
321 stars 213 forks source link

Issue with SEF URL / mod_rewrite #4296

Closed arel3 closed 3 years ago

arel3 commented 3 years ago

Bug Description

Navigation menu links in all themes have incorrect addresses for the modules ("plugins"). They don't load from the nav menu in any theme. Even the default theme that loads with the site right after installation. For example the forums link in every theme's menu loads site.url/forums. That directory doesn't exist! And it happens even with the default theme and 13 different browsers so it's not a browser issue.

This happens to every single module except the main page and the admin area. If want to go to my forums I have to manually enter /e107_plugins/forum/ to the url. Here is the default menu: Home News Content Contact Us Gallery Forum Downloads NONE of them, except Content and Home, load the correct URL.

Downloads doesn't even have an index.php

How to Reproduce

Steps to reproduce the behavior:

  1. Go to 'any menu link and click on it in any default theme'
  2. Click on '.any link in the menu. almost none of them load anything but a blank page of the default "there's nothing here" page from the host.'
  3. Scroll down to 'you can surely entertain yourself scrolling on a blank, white, page if you want.'
  4. See error.......blank, white, page because it's the wrong URL.

Expected Behavior

The module page loads.

Screenshots

I'm not bothering with all that time consuming work. It's every page except the Home link, admin area, and a select few others.

arel3 commented 3 years ago

I was going to give more link examples and fill out the rest of that nonsense but it sent the message when I pressed enter and I can't edit it.

Moc commented 3 years ago

Hi,

First of all:

Did the people who developed this not test your own product or...wtf?

I strongly suggest you adjust your tone if you'd like to have the help of volunteers who work on this project in their own spare time without getting any sort of compensation. I understand you are frustrated but this attitude is not the way to go.

As for your issues. It looks like you are having issues with SEF URLs - Search Engine Friendly URLs.

Please do the following:

Also, I assume you are running e107 version v2.3.0? Can you confirm that?

arel3 commented 3 years ago

I did call my host to ask about mod_rewrite however I didn't get to that point because I first explained the issue to them and they immediately knew, as you suggested Moc, that it has something to do with the .htaccess file. If I disable the file by renaming it or deleting it the pages load and everything seems to work correctly.

They explained it's because I'm on a Shared Hosting plan. I'm not fully aware what that means, that's subject for another question unless someone would kindly fill me in.

Of course I would like to keep the .htaccess file enabled. There are quite a few lines in that file. Which one is causing it?

I see that one of the lines enables RewriteRule so I assume that means mod_rewrite is enabled.

Yes, it's e107 v2.3.0.

Jimmi08 commented 3 years ago

@arel3 You can find it yourself on the PHP Info page: image

You can set in URL configuration not to use SEF-URLs, but then you need to change Sitelinks and put there legacy URL.

But you will need rewrite mode for images/files at least.

Moc commented 3 years ago

I recommend you show the webhosting provider the .htaccess file and ask them specifically which lines are causing the issue.

Apparently there is a conflict with their server configuration. They are in the best position to analyse the file. We may be able to make some tweaks once we have that information.

Also, shared hosting is not an excuse. A properly configured server configuration should support a .htaccess file, regardless of it being shared or not.

arel3 commented 3 years ago

@arel3 You can find it yourself on the PHP Info page: image

You can set in URL configuration not to use SEF-URLs, but then you need to change Sitelinks and put there legacy URL.

But you will need rewrite mode for images/files at least.

Thanks. I'll check that out.

I recommend you show the webhosting provider the .htaccess file and ask them specifically which lines are causing the issue.

Apparently there is a conflict with their server configuration. They are in the best position to analyse the file. We may be able to make some tweaks once we have that information.

Also, shared hosting is not an excuse. A properly configured server configuration should support a .htaccess file, regardless of it being shared or not.

I will attempt doing that and sharing the info when I have it. It is probably only this particular host's settings. Ionos (1and1) has always done things very differently than any other host.

arel3 commented 3 years ago

Might this have something to do with it? e107_phpinfo_error_curl

How do I disable Curl, and do I want to do that or will it cause other issues?

Rest of phpinfo if you'd like to see it:

System Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
Build Date Nov 30 2020 11:21:15
Server API CGI/FastCGI
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php7.4
Loaded Configuration File /etc/php7.4/php.ini
Scan this dir for additional .ini files (none)
Additional .ini files parsed (none)
PHP API 20190902
PHP Extension 20190902
Zend Extension 320190902
Zend Extension Build API320190902,NTS
PHP Extension Build API20190902,NTS
Debug Build no
Thread Safety disabled
Zend Signal Handling enabled
Zend Memory Manager enabled
Zend Multibyte Support provided by mbstring
IPv6 Support enabled
DTrace Support disabled
Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2, tlsv1.3
Registered Stream Filters zlib., bzip2., convert.iconv., string.rot13, string.toupper, string.tolower, string.strip_tags, convert., consumed, dechunk
LaocheXe commented 3 years ago

Who is your web(host) provider?

Moc commented 3 years ago

The warnings you see are unrelated to the SEF URL / mod_rewrite issue you are experiencing.

(cURL is enabled, and should be. The warning states that it is recommended to turn 'allow_url_fopen' off when cURL is enabled, since cURL is a way safer alternative. Also, unlike the name might suggest, cURL's functionality is not related to friendly URLs.)

This actually will prove my point, being the following: budget webhosting providers (such as 1&1) usually have server configurations that support their own business model (minimum use of resources - thus lower costs, and maximum users). This will always lead to issues. In short: "pay peanuts, get monkeys"

Once again, your issue lies in the mod_rewrite module. They will need to provide information on how to use it on their server configuration. Ask them to explain which lines in the htaccess file are conflicting with their configuration, and why. On the majority of server configuration, the current .htaccess file should run just fine. Otherwise we'd have many many more issues here.

Once we figure out what the exact conflict is, we may be able to accommodate a change in the .htaccess file. Otherwise it's up to you to either accept that you cannot use SEF URLs, or you should look into an alternative (preferably a non-budget) hosting provider.

arel3 commented 3 years ago

@Moc Thanks! I cannot afford better hosting at the moment or I surely would have went with a different host. If you happen to recall the introduction of php-nuke, evo, raven, nuke-platinum I was part of the php-nuke.org, nukeplanet, futurenuke and several other teams that introduced and supported these nuke CMS packages. I'm not new to websites but I haven't been in practice with it since 2008-ish so I'm surfing the learning curve again.

I did contact 1&1, sent them the .htaccess file, and asked them to look at it and explain what entries were causing the issue. They obviously didn't even look at the file (or all of the text because I also pasted the contents of the .htaccess file in the original message) because their reply said to "Add a line containing RewriteBase / to your .htaccess file.

I've removed the rem from that line, refreshed, and it produces another error now saying the root index.php is missing.

https://arel3.com/e107/ is with .htaccess enabled

https://arel3.com/e2/ is with .htaccess disabled.

I've shared both of those URLs with them and asked again exactly what you suggest I ask them. "Please inform me of the lines in my .htaccess file that are the cause of this issue and how I might go about correcting it. "

What is the mod_rewrite module? Is that on the host's end or something in the package e07 users have access to I'm able to change?

I'll continue to update sharing what 1&1 shares with me in hopes that they resolve this on their end or there ends up being something that can be tweaked with e107 or shared with users that might decide to use 1&1 so they don't have to go through this.

arel3 commented 3 years ago

@LaocheXe

Who is your web(host) provider?

1&1 / Ionos

LaocheXe commented 3 years ago

@LaocheXe

Who is your web(host) provider?

1&1 / Ionos

NFO Servers starts at $2.99 - https://www.nfoservers.com/order-webhosting.php

Jimmi08 commented 3 years ago

@arel3 you didn't copy that part loaded modules from your PHP info as on my screenshot

Moc commented 3 years ago

@arel3 Try this:

If you have installed e107 in the root of your domain, you can leave it like this. If you have installed e107 in a subfolder (e.g. "e2"), edit it to:

RewriteBase /e2

See if that helps.

Sidenote: mod_rewrite is an Apache module that is to be enabled by the provider on the server. It is not e107 related. This is not relevant in your case, since the mod_rewrite module already appears to be enabled. Your .htaccess file just requires an adjustment to work with 1&1's setup.

arel3 commented 3 years ago

@LaocheXe

I saw that and decided to go with 1&1 because they're currently running a promotion to have a domain and hosting $12 for the first year. I'm fully aware 1&1 is...we know! lol With how current situations are with everyone's lives I'm not sure how well a personal website that doesn't sell anything might go so for a year of hosting to give it all a shot....I can move to a better host next year if the site is worth keeping alive when that time comes.

@Jimmi08

@arel3 you didn't copy that part loaded modules from your PHP info as on my screenshot

I searched the phpinfo page for 'mod_rewrite' and 'loaded modules'. I don't have a loaded modules section as shown in your screen shot but I do have this:

REDIRECT_HTTP_MOD_REWRITE On
REDIRECT_HTTP_MOD_REWRITE_MEDIA On
REDIRECT_HTTP_MOD_REWRITE_STATIC On

The 'additional modules' section doesn't have anything listed. I don't have any addon modules installed, I didn't add anything that wasn't default due to having this issue. Less parts = less that can break. hahaha

@Moc That helps a little but doesn't correct all of the links. https://arel3.com/e107 is the installation with .htaccess enabled. e2 is disabled.

I added it to the e107 install and the download, news, and contact link work and load but forum still does not.

Moc commented 3 years ago

@arel3 For me https://arel3.com/e107/forum loads fine. I cannot see any forums though (have you created any with view permission for guests ("Everyone")?

image

What part of the forum is not loading properly for you? Try clearing your browser cache.

Jimmi08 commented 3 years ago

@Moc this works https://arel3.com/e107/forum/ this https://arel3.com/e107/forum (no backslash) image

Moc commented 3 years ago

@Jimmi08 Both with and without backslash are working fine for me. Are you sure it is not a caching issue?

Jimmi08 commented 3 years ago

firefox, never used before: image

arel3 commented 3 years ago

@Moc No, I didn't create any forums viewable to guests. I will so there's something there to see.

@Jimmi08 yes, that's exactly what I'm getting in Opera Gx, and Maxthon 5. The forums load with or without the slash in Chrome and (cringe) MS Edge.. I have other browsers for the purpose of testing sites and web code to insure everything works for all of them but I haven't tested it in all of the browsers I have...yet.

I'll add more forums. Apparently 1&1 is messing around with it because they over wrote what I had in the root by copying it there. ....smh... 👎 I don't want it live on the main url. especially if it's not secure or running properly in all browsers.

arel3 commented 3 years ago

firefox, never used before: image

That may be due to 1&1 tech trying things. Please give it a few minutes and try again. FireFox is not one of the browsers I have. I guess I'll have to get it, eh?

arel3 commented 3 years ago

Update from 1&1: They suggest leaving .htaccess disabled.

My 1&1 'consultant's reply:

I have pointed it back to the root directory and disabled the .htaccess by renaming it. If you click on download page it will go to the http://arel3.com/e107/e107_plugins/download/download.php as well the forum. I recommend to have the setup like https://arel3.com/e107/download/ because it's well uniform and not too long URL.

My colleagues and I will be happy to help you with any questions you may have about your Hosting products. You can reach me by phone, e-mail or chat. You will find my contact details under https://my.ionos.com. Should I not be directly available, a well-informed colleague from my team will answer your call.

Sincerely,

My response:

Sir,
That's not a solution. It leaves the site vulnerable to simple, easy, attacks. Please change the mod_rewrite settings or tell me what I need to edit or add in the .htaccess file so the site works as it's supposed to, with .htaccess enabled. 

I'm aware the chances of them editing their modrewrite settings is probably not something they'll do. Is there anything that can easily and quickly_ be done to tweak the package to avoid this issue?

It is working in chrome and edge with .htaccess enabled. So that means it's something with Opera and FireFox. (I'm getting FF now to try it myself).

Moc commented 3 years ago

It really should not depend on the browser. Technically irrelevant, it's a server side configuration.

You adjusted the 'RewriteBase' per their instructions and it still doesn't work. Their "consultants" cannot seem to figure it out either.

Pay peanuts, get monkeys.

What you can do is comment out the lines in the htaccess file that relate to mod_rewrite. In the admin area > settings > URL configuration you can set the non-SEF URLs. This way it should work.

Again, I'll point out that on all my devices it was working just fine. I suspect there's a caching issue (either browser or server side) that's triggering the different results. This may also be why your hosting provider may find it difficult to solve the issue.

Finally, I'm going to close this issue as it is a server configuration issue and not an issue with e107 itself. Let me know if I can help you further with the setup in the admin area using non-SEF URLs.

(btw: SEF URLs do not provide any added security other than security by obscurity. It's just more user friendly to have shorter and more descriptive URLs. It may also affect search engine ranking.).

Your other solution is moving to a 'proper' webhosting provider. I understand your financial considerations, please don't get me wrong :) In my experience it is way more cost effective to get better quality hosting (even aside from the time and energy spend on solving the current issue).

arel3 commented 3 years ago

Since I've edited to RewriteBase /e107 it all seems to be working in all browsers I've tried it on. The only browser I have that it's not working on, unfortunate-for-me my default browser, is Opera GX, That means now that you've given the info needed to solve the Rewrite issue stuff...it's browser related?

I have had other issues recently with other sites using Opera. I'm going to uninstall and re-install it to see if I have some kind of funky setting somewhere causing it.

Please don't close this yet unless you'd like me to start a new browser related topic.

Thank you all for helping with this!

arel3 commented 3 years ago

It was browser related. My installation of Opera GX is the only browser that's experiencing issues now. Opera (not GX), Edge, FireFox, Maxthon (3 different versions), and Safari are all working now since the edit to RewriteBase including the directory. Thank you all for the help, again!

Closing.

Jimmi08 commented 3 years ago

Maybe this could be helpful: - what to ask them.

https://github.com/e107inc/e107/issues/1421

And you should know that it takes time (in days) for some browsers to accept new htaccess... clear cache, cookies, nothing helps.