S
S
setevoi112018-06-17 22:46:54
Apache HTTP Server
setevoi11, 2018-06-17 22:46:54

How to correctly implement redirection in mod_rewrite?

How to correctly implement in mod_rewrite redirect
http://site/admin/ to admin.php
http://site/
http://site/other/ to index.php
do this

AddDefaultCharset utf-8

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^admin\/$ admin.php 
RewriteRule ^(.*)$ index.php

everything redirects to index.php only

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2018-06-17
@setevoi11

AddDefaultCharset utf-8

RewriteEngine on
RewriteBase /
RewriteRule ^admin\/$ admin.php 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question