Y
Y
Yapryntsew2015-01-03 14:39:34
PHP
Yapryntsew, 2015-01-03 14:39:34

How to properly hide get-parameter via mod_rewrite?

How to convert a link like site.ru?param=1 to site.ru/1 ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Nalomenko, 2015-01-03
@nalomenko

Something like this. You can write these directives in .htaccess if it is allowed in the directory settings in Apache

DirectoryIndex index.php

RewriteEngine on

RewriteRule ^([0-9]+)$ index.php?param=$1 [L]

If the param parameter can take not only numeric values, but also textual ones, then replace the set of valid characters from [0-9] to [a-zA-Z0-9] , or any other.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question