0

I hope someone can help me. I have a root installation of WP, but not as index.php (it's actually news.php). Consequently the_permalink() doesn't work, as the root of the website is a different page.

Is there any way I can fix this? Perhaps something in the .htaccess that detects ? in the URL and redirects to news.php/? etc.

Thanks for any assistance, I'm a newb at WP!

2 Answers 2

4

Change the name of news.php to index.php.

I don't know of any legitimate use case that exists for changing index.php.

If something else is using index.php then move WP in its own /news directory.

You could change the .htaccess but you might run into trouble down the road.

3
  • I've renamed news.php to index.php and moved it to its own news/ directory. I've also changed the site URL in the settings to domain.com/news/. I've also deleted the .htaccess file to make WP create a new one. But links to posts, comments, etc are STILL pointing to root (e.g. domain.com/?p=99 and not domain.com/news/?p=99). Please help! :( :(:( Commented May 29, 2012 at 19:54
  • Oddly enough the EDIT POST link is now pointing to the correct directory. Weird! Commented May 29, 2012 at 19:58
  • Did you move all the wordpress files to the subdirectory?
    – Adam
    Commented May 31, 2012 at 0:59
2

If you want to set up your site so that you have a home page that is outside your wordpress site (which is why I assume you have renamed the wordpress index.php file) the best way to set things up is to have wordpress installed in a sub directory off the root rather than in the root.

However, given you are already 'up the creek' so to speak there is another fix.

  1. Make a copy of your index.php file but place this before any of the content

...

<?php
 /*
 Template Name: Home Page
 */
 ?>
  1. Then save this page as homepage.php in your theme folder (/wp-content/themes/themename).

  2. Now go into WordPress admin and create a new page, call it 'Home' or whatever you like and on the right hand side select 'Home Page' from the template drop down.

  3. Go into the settings>reading menu in WordPress admin and change the option Front page displays option to 'A static page' and select the Home page you just created.

  4. Finally go back and remove your old index.php file and rename the news.php file to index.php

Whammo you will now be serving up the old index page through your WordPress install, and when people hit index.php on your site they won;t see the standard WordPress home page.

1
  • Thanks for your answer, I'm hoping to use a subdirectory, like you suggest. I hope I won't have to resort to the other solution you propose! Commented May 29, 2012 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.