Quantcast
Viewing all articles
Browse latest Browse all 4831

Weird redirect behaviour in Apache

@rzky wrote:

Hi guys,

Something, somewhere, adds a trailing slash in one of my route. Don't know why.

I'm serving Ember from an Apache server and uses this rewrite rule to send all request to index.html

<IfModule mod_rewrite.c>
    RewriteEngine On
    #RewriteBase /
    RewriteRule ^index\.html$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.html [L]
 </IfModule>

Everything seems fine until i have to replace the index page temporarily with a static page at /campaign.

// routes/index.js
export default Ember.Route.extend({
  ...

  beforeModel() {
    this.replaceWith('campaign');
  }

  ...
});

The homepage is correctly redirected to /campaign.

But when I refresh, this issue happens. Something adds a trailing slash at the end of the URL, and turns it into /campaign/. Which breaks the app.

There's nothing in the /routes/campaign.js. And this only happen to this page. The other works just fine.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4831

Trending Articles