S
S
Sergey2015-06-30 10:29:59
linux
Sergey, 2015-06-30 10:29:59

Why doesn't rewrite rule work in my htaccess?

I have a link:

ipaddr/opensys/base/

Or others similar:
ipaddr/opensys/base/something.php?olol=yep

I want to replace "opensys" and display "center" instead, i.e. convert links to:
ipaddr/center/base/
ipaddr/center/base/something.php?olol=yep

Initially, I just made a symlink on the server, but some plugins in this system did not start with this symlink, the system is complex and it is not possible to debug it. Therefore, I decided to do it through mod rewrite.
My htaccess:
RewriteEngine on
RewriteRule ^/opensys/base/(.*)$ /center/base/$1 [L]
RedirectMatch 301  ^/opensys/base/(.*)$ /center/base/$1

The redirect works fine, but new links get 404, i.e. rewriteRule not working, why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rainbird, 2015-06-30
@Rainberd

Most likely the 2nd line should be

RewriteRule ^opensys/base/(.*)$ /center/base/$1 [L]

In general, there are a lot of online .htaccess testers

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question