Home > Mobile >  .htaccess link with parameters
.htaccess link with parameters

Time:12-14

I have a page with URL like this: https://something.com/paste/log.php?log=H7nSEIPaVr

(By the way my homepage is: https://something.com/paste/index.php )

I want to make it work by just giving the log parameter like this: https://something.com/paste/H7nSEIPaVr And it would redirect me to the original url. (or it would be better if it just give me the paramter - ?log=xxx)

I have a .htaccess file, but it is not working for me. (rewrite is enabled, so the htaccess is working well)

RewriteEngine on
RewriteRule /paste/^([a-zA-Z0-9]*$)/?     /log.php?log=$1    [QSA]

CodePudding user response:

This probably is the rule you are looking for:

RewriteEngine on
RewriteRule ^/?paste/([a-zA-Z0-9] )/?$ /paste/log.php?log=$1 [L]

That rule needs to be implemented in the central http server's host configuration. Or, if you do not have access to that, you can instead use a distributed configuration file (typically called ".htaccess") which has to be located inside the http server's DOCUMENT_ROOT folder.

An alternative would be to place that variant in a distributed file inside the /paste folder:

RewriteEngine on
RewriteRule ^([a-zA-Z0-9] )/?$ log.php?log=$1 [L]
  • Related