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

  • SEARCH
  • Home
  • 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 9154809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:29:20+00:00 2026-06-17T12:29:20+00:00

There will be several high profile links for customers to focus on, for example:

  • 0

There will be several high profile links for customers to focus on, for example:

  • Contact Us @ domain.com/home/contact
  • About the Service @ domain.com/home/service
  • Pricing @ domain.com/home/pricing
  • How It Works @ domain.com/home/how_it_works

Stuff like that. I would like to hide the home controller from the URL so the customer only sees /contact/, not /home/contact/. Same with /pricing/ not /home/pricing/

I know I can setup a controller or a route for each special page, but they will look the same except for content I want to pull from the database, and I would rather keep my code DRY.

I setup the following routes:

Route::get('/about_us', 'home@about_us');
Route::get('/featured_locations', 'home@featured_locations');

Which work well, but I am afraid of SEO trouble if I have duplicate content on the link with the controller in the URL. ( I don’t plan on using both, but I have been known to do dumber things.)

So then made routes like these:

Route::get('/about_us', 'home@about_us');
Route::get('/home/about_us', function() 
{ 
    return Redirect::to('/about_us', 301);
});

Route::get('/featured_locations', 'home@featured_locations');
Route::get('/home/featured_locations', function() 
{ 
    return Redirect::to('/featured_locations', 301);
});

And now I have a redirect. It feels dumb, but it appears to be working the way I want. If I load the page at my shorter URL, it loads my content. If I try to visit the longer URL I get redirected.

It is only for about 8 or 9 special links, so I can easily manage the routes, but I feel there must be a smart way to do it.

Is this even an PHP problem, or is this an .htaccess / web.config problem?

What hell have I created with this redirection scheme. How do smart people do it? I have been searching for two hours but I cannot find a term to describe what I am doing.

Is there something built into laravel 4 that handles this?

UPDATE:

Here is my attempt to implement one of the answers. This is NOT working and I don’t know what I am doing wrong.

application/routes.php

Route::controller('home');

Route::controller('Home_Controller', '/');

(you can see the edit history if you really want to look at some broken code)

And now domain.com/AboutYou and domain.com/aboutUs are returning 404. But the domain.com/home/AboutYou and domain.com/home/aboutUs are still returning as they should.

FINAL EDIT

I copied an idea from the PongoCMS routes.php (which is based on Laravel 3) and I see they used filters to get any URI segment and try to create a CMS page.

See my answer below using route filters. This new way doesn’t require that I register every special route (good) but does give up redirects to the canonical (bad)

  • 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-17T12:29:21+00:00Added an answer on June 17, 2026 at 12:29 pm

    I used routes.php and filters to do it. I copied the idea from the nice looking PongoCMS

    https://github.com/redbaron76/PongoCMS-Laravel-cms-bundle/blob/master/routes.php

    application/routes.php

    // automatically route all the items in the home controller
    
    Route::controller('home');
    
    // this is my last route, so it is a catch all.  filter it
    
    Route::get('(.*)', array('as' => 'layouts.locations', 'before' => 'checkWithHome', function() {}));
    
    Route::filter('checkWithHome', function()
    {
        // if the view isn't a route already, then see if it is a view on the 
        // home controller.  If not, then 404
        $response = Controller::call('home@' . URI::segment(1));
        if ( ! $response )
        {
            //didn't find it
            return Response::error('404');
        }
        else
        {
            return $response;
        }
    
    });
    

    They main problem I see is that the filter basically loads all the successful pages twice. I didn’t see a method in the documentation that would detect if a page exists. I could probably write a library to do it.

    Of course, with this final version, if I did find something I can just dump it on the page and stop processing the route. This way I only load all the resources once.

    applicaiton/controllers/home.php

    public function get_aboutUs()
    {
            $this->view_data['page_title'] = 'About Us';
            $this->view_data['page_content'] = 'About Us';
    
            $this->layout->nest('content', 'home.simplepage', $this->view_data);
    }
    
    public function get_featured_locations()
    {
            $this->view_data['page_title'] = 'Featured Locations';
            $this->view_data['page_content'] = 'Featured properties shown here in a pretty row';
    
            $this->layout->nest('content', 'home.simplepage', $this->view_data);
    }
    
    public function get_AboutYou()
    {
        //works when I return a view as use a layout
        return View::make('home.index');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just wonder whether there will be any conflict if two service intents are
There will be a thumbnail as a left float, followed by the title and
Or there will be some conflicts ?
I will have a screen in which there will be 11 images one below
I guess there will be a very simple answer to this. But here goes.
During this year there will be coming couple sub-600€ multi-touch portable computers that contain
To clarify - there will be up to 4 distinct players in the table,
Does anyone know if there will ever be a true 64-bit version of Cygwin?
Once the system is shutdown there will be message in syslog file. I have
I have a site where there will be a list of offers that the

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.