Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm developing a single page site that shows each page on the front page, like so:

                                *-----------------*
                                | Home            |
                                |                 |
                                |                 |
                                |                 |
                                *-----------------*
                                | About           |
                                |                 |
                                |                 |
                                |                 |
                                *-----------------*
                                | Work            |
                                |                 |
                                |                 |
                                |                 |
                                *-----------------*

And I'm using history.js to alter the URL structure based on which section is visible in the viewport. Everything controlling this output is in my theme's index.php, and mirrored in the pages.php file. Which I'm sure there's a better way to do that, but I've no idea what it might be.

I want all pages that aren't /, /about or /work to redirect to the homepage (client doesn't want to use 404), another thing I don't know how to go about setting up.

I know I could put a PHP redirect in the single.php file and an include() in the pages.php but that doesn't strike me like the best option.

share|improve this question
1  
How many pages are we talking about? If you just have /about, /work and web root, why not set up an htaccess redirect to web root for anything not those three? –  Andrew Bartel May 1 '13 at 19:58
    
Well, It's 5 pages in total. And I hadn't considered that, dunno why not. Thanks! But what about the mirrored content in index.php and page.php? –  Little Big Bot May 1 '13 at 21:11
1  
Is it even necessary to have anything in page.php if everything is truly in index.php? If you don't have a page.php, it will be bypassed in the template hierarchy and index.php will be loaded. –  Andrew Bartel May 1 '13 at 21:14
    
Removed page.php and it works, thanks! Never built a template without the standard files. –  Little Big Bot May 1 '13 at 21:41
1  
Sure thing, in the future you can refer to: codex.wordpress.org/Template_Hierarchy. Did you get the .htaccess part figured out? –  Andrew Bartel May 1 '13 at 21:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.