A
A
Andrew2016-04-09 19:55:30
PHP
Andrew, 2016-04-09 19:55:30

How to write replacement for GET request in htaccess?

Hello, there is a "save" local domain, the script on it accepts a get request, say "q" (save/index.php?q=query), what should be written in .htaccess so that it would be like this 'save/query'?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Vorobei, 2016-04-10
@ntzch

RewriteCond %{REQUEST_METHOD} GET
RewriteRule ^ index.php [L]

No need to explain, it's simple

M
Maxim Timofeev, 2016-04-09
@webinar

For such things, a php component (url manager) is written, I think the network is full of ready-made solutions and is connected to index.php

S
Shirshov Alexander, 2016-04-09
@Keanor

You need to read about apache mod_rewrite, here is an excellent article if you want to dive: https://habrahabr.ru/company/sprinthost/blog/129560/
You won't have to change anything as a router on the application side if you don't need to generate "correct" links. The script will work the same for index.php?q=query and just query.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question