[SOLVED] Absolute vs Relative Paths
[SOLVED] Absolute vs Relative Paths
Hi, i had to change INC_ROOT', dirname(__FILE__)); by define('INC_ROOT', $_SERVER["DOCUMENT_ROOT"] );
Now i got an 500 Internal server error... learning htaccess...
Now i got an 500 Internal server error... learning htaccess...
Re: Absolute vs Relative Paths
Hello rnd, have a warm welcome to the community.
Can you check if your function url is exactly like the one below? If not sure, simple replace it with the one pasted below.
Also, are you running / have hosting on a Windows IIS server?
Can you check if your function url is exactly like the one below? If not sure, simple replace it with the one pasted below.
Code: Select all
public static function url($location = null) { return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? > 'https://' : 'http://').$_SERVER['HTTP_HOST'].str_replace($_SERVER['DOCUMENT_ROOT'], '', str_replace('\', '/', > dirname($_SERVER['SCRIPT_NAME'])))."/{$location}"; }
Re: Absolute vs Relative Paths
Apache
This url function needs to remove 2 "greater than" symbols and missing 1 escape '\'
then i get 'myserver.com//home'
and 500 Internal error.
This url function needs to remove 2 "greater than" symbols and missing 1 escape '\'
Code: Select all
public static function url($location = null)
{ return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ?
'https://' :
'http://').$_SERVER['HTTP_HOST'].str_replace($_SERVER['DOCUMENT_ROOT'], '',
str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME']) ) )."/{$location}";
}
and 500 Internal error.
Re: Absolute vs Relative Paths
Thanks for the code fix, haven't seen a case where this wouldn't work.
What version of PHP are you running on, and have you made any changes to .htaccess?
Would you mind trying out the unreleased WonderCMS 2.0 https://github.com/robiso/wondercms-test and post the results?
What version of PHP are you running on, and have you made any changes to .htaccess?
Would you mind trying out the unreleased WonderCMS 2.0 https://github.com/robiso/wondercms-test and post the results?
Re: Absolute vs Relative Paths
PHP Version 5.6.30
This happened after i changed my hosting plan, maybe the providers modified something on php.ini.
The unreleased version gives me same error, i will try to fix this or try to back 0.x.x and check... next week will have more free time.
Nevermind, i like challenges
This happened after i changed my hosting plan, maybe the providers modified something on php.ini.
The unreleased version gives me same error, i will try to fix this or try to back 0.x.x and check... next week will have more free time.
Nevermind, i like challenges
Re: Absolute vs Relative Paths
This is also extra weird since we do things a little bit differently in version 2.0, so the error should be at least in another line. Is there anything in your error log?
If it worked before you've changed your hosting package - you're in the right direction. But we would still love to get to the bottom of this.
Make sure your new hosting plan supports .htaccess.
You can also attach your WonderCMS files in a ZIP here, if you've made any changes to the files.
Hope we get to fix your problem as soon as possible.
If it worked before you've changed your hosting package - you're in the right direction. But we would still love to get to the bottom of this.
Make sure your new hosting plan supports .htaccess.
You can also attach your WonderCMS files in a ZIP here, if you've made any changes to the files.
Hope we get to fix your problem as soon as possible.
Re: Absolute vs Relative Paths
Alternatively, try out the old .htaccess, might just do the trick.
Code: Select all
Options -Indexes
ServerSignature Off
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA,L]
RewriteRule database.js - [F]
Re: Absolute vs Relative Paths
Solved! with my old .htaccess now works like charm, time to play.
Code: Select all
#RedirectMatch 403 ^.*/files/
ErrorDocument 403
RewriteEngine on
Options -Indexes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1#%{REQUEST_URI} ([^#]*)#(.*)\1$
RewriteRule ^([^\.]+)$ %2?page=$1 [QSA,L]
RewriteCond %{THE_REQUEST} password($|\ |\?) [NC]
RewriteRule .* - [F]
#Disable Hot-linking
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://domain.com/.*$ [NC] [OR]
RewriteCond %{HTTP_REFERER} !^http://www.domanin.com/.*$ [NC] [OR]
RewriteRule .*\.(gif|GIF|jpg|JPG|bmp|BMP|wav|mp3|wmv|avi|mpeg|pdf)$ - [F]
Re: [SOLVED] Absolute vs Relative Paths
Topic marked as solved - thanks rnd.
For future reference, mind answering which .htaccess worked for you?
1. The one you posted last?
2. The one I posted?
For future reference, mind answering which .htaccess worked for you?
1. The one you posted last?
2. The one I posted?
Re: [SOLVED] Absolute vs Relative Paths
My version.