M
M
maxxxixxxx2014-07-31 02:51:49
PHP
maxxxixxxx, 2014-07-31 02:51:49

How to write a Mod Rewrite rule?

There is a url
site.xx/GjddfrF
It is necessary that everything after / be redirected without a redirect to
site.xx/index.php?hash=GjddfrF
When site.xx is opened, site.xx/index.php would be launched and no redirects would occur
. a bunch of other links that shouldn't be redirected either, for example:

http://site.xx/book/
http://site.xx/url/

I try like this, leads to a glitch
RewriteRule ^(.*)/?$ index.php?hash=$1 [L,QSA]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Pyatkov, 2014-07-31
@dkrnl

RewriteCond %{REQUEST_FILENAME} !-f # not a file
RewriteCond %{REQUEST_FILENAME} !-d # not a directory
RewriteCond %{REQUEST_FILENAME} !-s # not a symlink
RewriteCond %{REQUEST_FILENAME} !-l # not a link
RewriteRule ^(. +)$ /index.php?hash=%{QUERY_STRING} [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question