Announcement

Collapse
No announcement yet.

Problem moving rewrites from .htaccess to vhost

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Problem moving rewrites from .htaccess to vhost

    One of the things mentioned at MivaCon this year was the idea of streamlining the .htaccess file as much as possible, to speed up server response time. With some help from Miva I started moving my .htaccess rules over, but some won't work. Maybe someone here has some ideas?

    In .htaccess this works fine:

    Code:
    RewriteRule ^example$ /example/ [L,R=301]
    RewriteRule ^example/$ mm5/merchant.mvc?Screen=example [QSA]
    With the idea being that if someone visits example.com/example- they get redirected to example.com/example/ (just adding the trailing slash). Then the trailing slash version of the URL gets rewritten behind the scenes (to mm5/merchant.mvc?Screen=example). When I move this over to vhost I hit a couple of snags:
    1. It turns into an infinite loop of redirects (the server stops it at 10), because the first rule is always triggered.
    2. After I comment out the first rule, I get a "Bad Request" 400 error:
      Bad Request Your browser sent a request that this server could not understand. Client sent malformed Host header
      1. I also tried:
        Code:
        RewriteRule ^/example/$ /mm5/merchant.mvc?Screen=example [QSA]
        But then the error changes to:
        Unable to execute 'example/': No such file or directory
    Looking for work as of March 2024! I've been a web developer for going on 20 years, with most of that time spent on Miva sites.
Working...
X