A
A
Ar jeck2017-07-25 23:57:17
htaccess
Ar jeck, 2017-07-25 23:57:17

How to put everything after the slash into a parameter?

Let's say there is a site.com, how can I use .htaccess to make the site.com/ef3Te link, for example, turn into site.com/?param=ef3Te ?
The code I am currently trying to use looks like this

RewriteEngine On
RewriteBase /
RewriteRule ^-(.*) /?param=$1 [L]

It doesn't work, the server returns 404

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Igor, 2017-07-26
@hurgadan

So?

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ index.php?p=$1 [L,QSA]

Y
Yuri Esin, 2017-07-26
@Exomode

RewriteRule ^([^/]*)/$ /?arg1=$1 [L]
RewriteRule ^([^/]*)/([^/]*)/$ /?arg1=$1&arg2=$2 [L]

and a couple of useful links on the topic:
htaccess
generator Redirect
generator Mod_rewrite regex generator, helped me out a bunch of times

V
Viktor Taran, 2017-07-26
@shambler81

As far as I understand, you are going to write your CNC, oh my God?
I think you should read about them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question