New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No redirection when using "www" #2354

Open
ayyoovod opened this Issue Jan 12, 2018 · 10 comments

Comments

Projects
None yet
7 participants
@ayyoovod

ayyoovod commented Jan 12, 2018

Hello;
Our short URLs are not properly redirecting when using "www".
I can access the home page with or without "www" but it returns back to home page if I use "www" with the shortned url.
Thanks for any feedback.

@ozh ozh added the bug label Jan 13, 2018

@ozh

This comment has been minimized.

Show comment
Hide comment
@ozh

ozh Jan 13, 2018

Member

Indeed, I can reproduce this.

Very vanilla install: http://sho.rt/ozh works but http://www.sho.rt/ozh doesn't (redirects to root), while both http://sho.rt/admin/ and http://www.sho.rt/admin/ are OK.

Member

ozh commented Jan 13, 2018

Indeed, I can reproduce this.

Very vanilla install: http://sho.rt/ozh works but http://www.sho.rt/ozh doesn't (redirects to root), while both http://sho.rt/admin/ and http://www.sho.rt/admin/ are OK.

@PopVeKind

This comment has been minimized.

Show comment
Hide comment
@PopVeKind

PopVeKind Jan 15, 2018

Contributor

Just a clue...

After I made the last YOURLS_SITE patch, I tested the www vs no-www issue and both worked.

I then used server configuration (.htaccess) to make the following tests:

  1. allow www but disallow no-www
  2. disallow www but allow no-www
  3. allow www and allow no-www

Therefore, the 17 changes that the YOURLS_SITE patch made, may have touched on the problem.

As I said, this is just a clue!

@ozh - I have stopped working on the YOURLS_SITE patch. The more I worked on it, the more I became aware that it would be better to just move core constants into the DB and serve them as options through $ydb. Therefore, I am actively working on an admin config page for that purpose. This plus the full-fledged installer should solve this problem, the trailing slash problem, and the split YOURLS_SITE problem.

Contributor

PopVeKind commented Jan 15, 2018

Just a clue...

After I made the last YOURLS_SITE patch, I tested the www vs no-www issue and both worked.

I then used server configuration (.htaccess) to make the following tests:

  1. allow www but disallow no-www
  2. disallow www but allow no-www
  3. allow www and allow no-www

Therefore, the 17 changes that the YOURLS_SITE patch made, may have touched on the problem.

As I said, this is just a clue!

@ozh - I have stopped working on the YOURLS_SITE patch. The more I worked on it, the more I became aware that it would be better to just move core constants into the DB and serve them as options through $ydb. Therefore, I am actively working on an admin config page for that purpose. This plus the full-fledged installer should solve this problem, the trailing slash problem, and the split YOURLS_SITE problem.

@ivanavie

This comment has been minimized.

Show comment
Hide comment
@ivanavie

ivanavie Jan 22, 2018

I am having the same issue. http://gbfam.us/nlamar will take you to the correct page, but www.gbfam.us/nlamar goes to the homepage (root). I found this issue posted before (#1080) but could not see any comments or solutions. Has anyone fixed this?

ivanavie commented Jan 22, 2018

I am having the same issue. http://gbfam.us/nlamar will take you to the correct page, but www.gbfam.us/nlamar goes to the homepage (root). I found this issue posted before (#1080) but could not see any comments or solutions. Has anyone fixed this?

@ayyoovod

This comment has been minimized.

Show comment
Hide comment
@ayyoovod

ayyoovod Jan 22, 2018

Apparently the new patch might have fixed this issue. I didn't get a chance to test it yet.

ayyoovod commented Jan 22, 2018

Apparently the new patch might have fixed this issue. I didn't get a chance to test it yet.

@ivanavie

This comment has been minimized.

Show comment
Hide comment
@ivanavie

ivanavie Jan 23, 2018

I am running 1.7.2 - is there something newer than that?

ivanavie commented Jan 23, 2018

I am running 1.7.2 - is there something newer than that?

@codegrrrl

This comment has been minimized.

Show comment
Hide comment
@codegrrrl

codegrrrl Jan 23, 2018

We run 1.7.2 and were having this problem. I put a dirty fix in and wanted to share for anyone else. It fixes urls with www. in them but doesn't fix other subdomains.

In yours-loader.php, find the line below (~line 21)
$request = yourls_get_request();

After it, add:
$request = preg_replace('/^www./','',$request);

codegrrrl commented Jan 23, 2018

We run 1.7.2 and were having this problem. I put a dirty fix in and wanted to share for anyone else. It fixes urls with www. in them but doesn't fix other subdomains.

In yours-loader.php, find the line below (~line 21)
$request = yourls_get_request();

After it, add:
$request = preg_replace('/^www./','',$request);

@ivanavie

This comment has been minimized.

Show comment
Hide comment
@ivanavie

ivanavie Jan 23, 2018

Thanks, works!

ivanavie commented Jan 23, 2018

Thanks, works!

@ayyoovod

This comment has been minimized.

Show comment
Hide comment
@ayyoovod

ayyoovod Jan 23, 2018

Yep! I concur. Thanks @codegrrrl

ayyoovod commented Jan 23, 2018

Yep! I concur. Thanks @codegrrrl

@boumaj123

This comment has been minimized.

Show comment
Hide comment
@boumaj123

boumaj123 Jun 22, 2018

YES! I've been pulling my hair over this, now it's fixed. Thanks @codegrrrl for your time and expertise 👍

boumaj123 commented Jun 22, 2018

YES! I've been pulling my hair over this, now it's fixed. Thanks @codegrrrl for your time and expertise 👍

@vivekrp

This comment has been minimized.

Show comment
Hide comment
@vivekrp

vivekrp Jul 14, 2018

Thanks @codegrrrl, tried many solutions but this fixed it :)

vivekrp commented Jul 14, 2018

Thanks @codegrrrl, tried many solutions but this fixed it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment