D
D
DoRcK2014-05-04 22:56:59
PHP
DoRcK, 2014-05-04 22:56:59

URL conversion

Hello. Faced a problem. There is a .htaccess file with the following content (not written by me):

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} /$ [NC]
RewriteRule ^(.*)(/)$ $1 [L,R=301]
RewriteRule ^.*$ index.php [L]

At its core, it should send all requests to index.php. To my indignation, the same thing happens with all links, for example css. As a result - a trough. Could you please suggest the code for transforming requests so that
website.net/?1=$1&2=$2 and so on... will be converted to website.net/$1/$2 etc. Looking forward to your code examples.
PS: Links like: website.net/css/main.css should not fall under this rule, so as not to kill the site.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Petrusha Ukropov, 2014-05-04
@artishok

Add
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
before
RewriteCond %{REQUEST_URI} /$ [NC]

L
lnked, 2014-05-05
@lnked

RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([a-zA-Z0-9_/\-\:]*)$ index.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question