[Abandoned] URL returning different directories based on link
Added by teamcoltra 2 months ago
I don't have my Lighttpd config right now because I'm having an unrelated issue logging into my VPS (relating to being in China right now, not this issue), however, maybe we can figure out what's wrong without them while I try to get in:
If you go to facebook.com /profile.php?id=100095387436789 and click the link it will redirect you to www dandtea.com HOWEVER if you copy and paste the url it will take you to auditorydefense.com
My config is
/var/www/dandtea is default route
/var/www/auditorydefense is setup for host = auditorydefense.com
If you go to /var/www/dandtea/index.php it will redirect you to www dandtea.com
I can't find anything in the logs that would indicate what's happening. Enabling access logs DOES SHOW the connections but it just looks like the connections for auditorydefense.com are supposed to go to dandtea.com and the connections that work are going to where they are supposed to.
It's like a roundrobin issue but 100% of the time when you click the Facebook link it takes you to the wrong domain.
I thought it might be a cloudflare rule so I disabled those and have waited overnight and that's not the issue I don't think.
Replies (7)
RE: URL returning different directories based on link - Added by teamcoltra 2 months ago
https://paste.lighttpd.net/BC#s735boSSfUVKmDwtIP7OvPj3
Here is my config file
RE: URL returning different directories based on link - Added by gstrauss 2 months ago
Please read How to get support
From the config you shared, I did not see any url.rewrite url.redirect directives. However, you only posted part of your config. Instructions above tell you how to ask lighttpd to print the entire config, with all includes.
/var/www/dandtea is default route
/var/www/auditorydefense is setup for host = auditorydefense.comIf you go to /var/www/dandtea/index.php it will redirect you to www dandtea.com
Sounds to me like your problem might be in your PHP code.
RE: URL returning different directories based on link - Added by teamcoltra 2 months ago
This is my entire config file. If it's missing something you would expect to see let me know.
Line 6 shows my mod_rewrite being loaded and 81 and 101 use rewrite-final. This part works as far as I can tell. It's rewriting the right things.
The problem can't be in my code, if Lighttpd was using the proper document-root then it wouldn't trigger the PHP redirect.
RE: URL returning different directories based on link - Added by gstrauss 2 months ago
I mistyped. I don't see url.redirect
and you did not read the link I asked you to read. Please read it carefully.
RE: URL returning different directories based on link - Added by teamcoltra 2 months ago
That is my full /etc/lighttpd/lighttpd.conf (running the commands in the link give this same output)
I'm running Debian Buster
I'm running 1.4.53 (SSL) (which is built in to Buster)
I am not using a url.redirect I don't believe.
RE: URL returning different directories based on link - Added by gstrauss 2 months ago
That is my full /etc/lighttpd/lighttpd.conf (running the commands in the link give this same output)
No, it is not. lighttpd reads other files when it sees include
. When lighttpd prints the config, lighttpd replaces include
with the parsed contents of those included files.
I'm running Debian Buster
Debian Buster is end-of-life and no longer supported by Debian. That means it is ancient.
I'm running 1.4.53 (SSL) (which is built in to Buster)
That is ancient. lighttpd 1.4.53 was released over 4 1/2 years ago!
The latest lighttpd is lighttpd 1.4.71 (and soon lighttpd 1.4.72) You are at least 18 (!!!) lighttpd releases out-of-date.
I am not using a url.redirect I don't believe.
Your original post uses the word "redirect". That suggests redirection, e.g. an external redirect 301 302 303 307 308 sent to client. redirection is handled by mod_redirect, which is loaded in your config.
If you instead meant that the url was rewritten internally in lighttpd, that is not what you wrote. Internal url rewriting is done by lighttpd mod_rewrite, not mod_redirect.
I see that you have debug.log-request-handling = "enable"
in your lighttpd config, so check your lighttpd error log to see what document root ends up being used for requests.
RE: URL returning different directories based on link - Added by gstrauss 2 months ago
url.rewrite-final = ( # Exclude some directories from rewriting "^/(wp-admin|wp-includes|wp-content|gallery2)/(.*)" => "$0", # Exclude .php files at root from rewriting "^/(.*.php)" => "$0", # <== This is not limited to what the comment describes # Handle permalinks and RSS feeds "^/(.*)$" => "/index.php/$1" )
can be more efficiently written as
url.rewrite-final = ( # Exclude some directories from rewriting "^/(?:wp-admin|wp-includes|wp-content|gallery2)/" => "", # Exclude .php files at root from rewriting "^/[^/]+\.php" => "", # Handle permalinks and RSS feeds "" => "/index.php${url.path}${qsa}" )
or, if all of those files are present in the document root, then very simply:url.rewrite-if-not-file = ( "" => "/index.php${url.path}${qsa}" )