G
G
gmrsfwevewrzrzw2020-09-19 07:21:05
Apache HTTP Server
gmrsfwevewrzrzw, 2020-09-19 07:21:05

How to write rewrites for an Instagram-like service?

Hey! the essence is the following:
mod_rewrite.
http://site.com/& http://site.comshould redirect to site.com/index.php
BUT http://site.com/aeiu3bx(i.e. ([A-Za-z0-9#]+)) should redirect to site.com/index.php?param=$1

There are rules like this:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?param=$1 [L]

and they don't work properly.
More precisely, only the last rule works - site.com/o3unxo3-> site.com/index.php?param=o3unxo3,
but it site.com/turns into some kind of mess of paths like site.com/home/var/www/site.com/site.com/

How to be???? 6 years ago I myself did such a thing on some forum in the answers, but I rubbed everything and I can’t find it by God) and formulate it for Google too

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-09-19
@FanatPHP

those rewrites that you showed here work great
and for the voiced tasks of this code, a
sausage with a root request is enough - this is the code that you don’t show us,
so you need to throw out the rest of the code responsible for rewrites and redirects, and everything will work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question