M
M
misha912012-05-30 18:41:40
Apache HTTP Server
misha91, 2012-05-30 18:41:40

How to shorten URL in .htaccess (using Mod-Rewrite)?

For example, the site itself is located here - domain.com/folder/index.php
How can I use mod-rewrite to type domain.com/index.php from the browser line?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Mikhail Osher, 2012-05-30
@miraage

Read .

N
Nikita Permin, 2012-05-30
@NekitoSP

Was just tinkering with this today. I'm not sure, but try (or correct if you suddenly made a mistake):

AddDefaultCharset UTF-8

RewriteEngine	on
RewriteBase	/

RewriteRule ^m/(.+)       /files/$1   [L,QSA]
RewriteRule ^files/$  - [F,L]

S
Sergey Bondarenko, 2012-05-31
@BR0kEN

RewriteRule /index.php+$ /folder/index.php [L]

M
Mikhail Osher, 2012-05-31
@miraage

In order for the site to open at the desired address, you need to put .htaccess not in the folder folder, but one level higher.
The htaccess rule is something like this:

RewriteCond %{REQUEST_URI} ^/index\.php
RewriteRule (.*) domain/index.php [L,QSA]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question