N
N
Nikita Kolosov2016-04-19 21:54:24
Apache HTTP Server
Nikita Kolosov, 2016-04-19 21:54:24

What is the correct way to write a RewriteRule for .htaccess?

I'm not sure if this is actually possible, but the problem is this:
There is a website, let's say example.com
There is a certain module that works on example.com/foo/index.php
Accordingly, there are various URLs like example.com /foo/bar/far , which should all be handled by example.com/foo/index.php
You have the following .htaccess

RewriteEngine on

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

RewriteRule . index.php

And everything is fine as long as this module works in the root ( http://example.com)
The problem is that inside the module in the links all URLs look like this: Is it possible to somehow
<a href="/bar/far">Test link</a>
get rid of this by RewriteRule or do I need to change all links in code to /foo/bar/far so that /bar/far "arrives" in index.php?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Novikov, 2016-04-20
@Anexroid

You understand that a link like /bar/far has nothing to do with the foo module, right? It leads to the root of the site. In any case, you need to change links.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question