Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8643051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:56:11+00:00 2026-06-12T11:56:11+00:00

How do I match all .html files with High Voltage ‘s controller in Rails

  • 0

How do I match all .html files with High Voltage‘s controller in Rails so that any url with .html at the end opens the corresponding pages/<page>.html.erb file in my views directory? And of course then I can reference it with High Voltage’s page_path named route?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:56:13+00:00Added an answer on June 12, 2026 at 11:56 am

    I don’t think it’s possible, or at least trivial. The “suffix” part of the URL is mapped to the format of the request, e.g., /pages/document.html, /pages/document.json, /pages/document.xml, /pages/document.csv, etc. That is fundamental to Rails routing, and .html is the default format, so /pages/document will, by default, return HTML. It might be possible to create a route such as:

    match '*.html' => 'high_voltage/pages#show', as: :static
    

    I have not tested it though.

    If you put the match at the bottom, it might be the case that even if the incoming url has .html on it, it will match something else before. Conversely, if you put it at the top, it might match everything that does not have a suffix. Should be easy enough for you to test it.

    My high voltage route:

    get '/:id' => 'high_voltage/pages#show', as: :static
    

    is at the bottom of my routes, right before the root url, so it’s basically the catch all. As long as my static html file paths are distinct from my RESTful routes, it works fine.

    Otherwise, if it’s acceptable for those static URLs to redirect (permanent), you could put the match in the upstream HTTP server, like nginx or apache, and redirect it to a known high voltage path, like /pages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to match all lines that have any uppercase characters in them but
Given the HTML below, I am trying to use jQuery to match all the
Some of my HTML files contains string like : {foreach $any_kind_of_charaters} Any kind of
Possible Duplicate: Regular expression: match all words except I need your help for using
I want to match all URLS but exclude image urls from beeing matched with
I want to match all the lines in a file either starting with 0D
I'm trying to do a preg match all on the response below to get
I have some constants in JavaScript that I'd like to reuse in several files
I'm really confused by all that caching stuff. I'm trying to setup mod_expires to
I've found this code in base 64 on all php files of one of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.