The requested URL /5m7x9 was not found on this server.
ubuntuchosen opened this issue · 6 comments
I'm having issues get this to work under MAMP or a hosted public server, the url rewriting causes it to spit out errors where it can't find the requested URL of any new or old note. I couldn't find any info/faq about this error, so I'm posting it as an issue.
Do you have any more details on the error please, screenshots or the error text would be perfect... Plus anything written in the PHP error log.
It also generally works using variables in the config.php, but you could also try hard coding the $base_url - comment out
$base_url = dirname('//'.htmlspecialchars($_SERVER['HTTP_HOST']).$_SERVER['PHP_SELF']);
and put this instead, changing the URL to match your URL
$base_url = 'https://myserver.com/notes';
Thanks
Thanks for getting back to me.
- I'm running MAMP: https://i.ibb.co/nLSG9Cg/mamp.png
- The directory of localhost:8888 looks like this: https://i.ibb.co/4tnbJ4K/directory.png
- The config.php file looks like this: https://i.ibb.co/z8xRFjR/config.png
- Opening up the website: https://i.ibb.co/D4Pvdjj/result.png
I can't find any php error log unfortunately. This result comes up even if I use the original $base_url, even if I hardcode it.
Thanks!
Apologies for the slow reply :(
Thanks for the detailed screenshots, much appreciated - I don't have a MAMP stack to test this on but I wonder if this is an a .htaccess
problem? Can you confirm there is a .htaccess
file and that the contents match the repos version (small snippet below but not the full file). The setup.php
file should be better here as it does check there is a .htaccess
file in the notes data directory but not in the code folder and maybe this file isn't there in your case.
RewriteEngine On
#RewriteCond %{HTTPS} off
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
# if there is a view parameter in the querystring then use view.php
RewriteCond %{QUERY_STRING} ^view [NC]
RewriteRule ^([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)$ view.php?note=$1 [L,QSA]
# the [L] flag will stop any futher processing
If it is there and has the full code in it then let me know and we'll work it from there. I thought this was a good page for diagnosing problems with .htaccess, or at least confirming it works as expected
https://docs.bolt.cm/3.7/howto/making-sure-htaccess-works - their php tester page is good and I'll include some logic from it in in my setup.php
Thanks
Updated setup.php
to do a check on .htaccess
in the notes code folder as well as the notes data directory
@domOrielton okay so this was definitely it :) I made sure to show all hidden files on macos, and now the .htaccess file is showing up correctly and everything works. Thank you very much for your time :) The update you made to setup.php also helps a lot!
My pleasure, this has definitely happened to me before! Hopefully this will be useful to others too (I've tidied up the post a bit by deleting the bump messages).