Code Monkey home page Code Monkey logo

Comments (5)

lfdelphino avatar lfdelphino commented on June 14, 2024

Hey @old , I was experiencing the same issue and I could fix it.

There are a few things that may be causing it, first of all, are you trying to use a different URL to shorten your links or the default index.php? If it's the default shouldn't be a problem.

Second, make sure that you run the following SQL command on your MySQL or MariaDB:
CREATE TABLE urls ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, url VARCHAR(1000) NOT NULL, created DATETIME NOT NULL, accessed DATETIME, hits INT UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (id), UNIQUE (url) );

I was using a different SQL code that I found by mistake and also my goal was to be able to shorten the URL at a different location, to do so you would only have to change on .htaccess from:
RewriteRule ^(.*)$ index.php?q=$1 [QSA,L]
to (change the NEW_URL):
RewriteRule ^(.*)$ https://%{HTTP_HOST}/NEW_URL.php?q=$1 [QSA,L]

Hope it works!

from shorty.

Nottt avatar Nottt commented on June 14, 2024

I'm having the same issue, but the above solution didn't help me! Running the sql command just says:

ERROR 1050 (42S01): Table 'urls' already exists

from shorty.

lfdelphino avatar lfdelphino commented on June 14, 2024

First remove your table urls, then run the above SQL please

from shorty.

Nottt avatar Nottt commented on June 14, 2024

My website domain is subdomain.domain.com, and I'm generating subdomain.domain.com/link/XXX o i still need to use your SQL command?

I'm a bit lost here, ideally I'd like to use another domain, a shorter one in the generated links... like xx..cc which I own, I'm just using that for testing...

Do I need to have my xx.cc domain pointed to the same IP address as my subdomain.domain.com? Do I need to change something in apache?

My shorty files are in /var/www/html/link so that's why i went with that for testing...

from shorty.

Nottt avatar Nottt commented on June 14, 2024

ok, so my issue seems that going to xx.cc redirects to subdomain.domain.com/XXX and this doesn't work but subdomain.domain.com/link/XXX works.

How to fix this?

Edit:

I fixed this with a cloudflare rule, I now forward xx.cc/* to subdomain.domain.com/link/ so it works. I'm doing 2 redirects to get to the shortened link but at least works.

A solution which only does 1 redirect locally would be better/faster

from shorty.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.