Giving Wordpress it´s own directory
Psst! In swedish after the “read more” link / Psst! På svenska efter “läs mer” länken!
I’ve been getting som questions about how to have your WP-install in a subfolder but without the /wordpress-suffix on your domain, mainly by people that have used some sort of auto-installer to set up their blog.
This often results in a situation where you already have a subdirectory and the blogadress is set to www.domainname.com/wordpress or corresponding. The instructions in the WP codex presumes that you are moving your WP files, sometimes making it a bit confusing for beginners to understand them.
Changing this acually isn’t that difficult, so here it goes:
First; some need-to-knows:
1. Use some kind of ftp-program to access the files.
2. To save yourself from headache – do not change any settings in the WP admin area under Settings/General until the very last step! ![]()
3. The original index.php-file in /public_html/wordpress/ is to remain unaltered, you only need to copy it!
3. The root folder is commonly named “public_html” but not always. If unsure – ask your web host.
4. These instructions presumes that the folder where your Wordpress files are located is called “wordpress”, that your domain name is “yourbloghere.com” and that your root folder is called “public_html”.
Let’s get to work!
1. Go to /public_html/wordpress/ and download the file called index.php.
2. Open index.php in for example Notepad and find where it says require(‘./wp-blog-header.php’);
3. Change this into require(‘./wordpress/wp-blog-header.php’); and save the file.
4. Make sure you don’t have any files named index.html, index.php or anything like that in /public_html/. (If you do – rename them to for example index_old.)
5. Upload your altered index.php here. (Not in /public_html/wordpress/!)
6. Make sure everything is correct and that the “index.php” in /public_html/wordpress/ looks the same way it did when you started.
7. Now go to the admin area of your blog, Settings -> General and change “Blog address (URL)” to “http://yourbloghere.com”. (The “WordPress address (URL)” should be “http://yourbloghere.com/wordpress”)
8. Voilá – your done! Surf to http://yourbloghere.com/ and take a look! =)
Och så på svenska:
1. Gå till /public_html/wordpress/ och ladda ner filen som heter index.php.
2. Öppna index.php i exempelvis Anteckningar och hitta där det står require ( ‘./wp-blog-header.php’);
3. Ändra detta till require ( ‘./wordpress/wp-blog-header.php’); och spara filen.
4. Kontrollera att du inte har några filer som heter index.html, index.php eller liknande i /public_html/. (Om du har det – döp om dem till exempelvis index_old.)
5. Ladda upp din modifierade index.php till /public_html/ . (Inte till /public_html/wordpress/!)
6. Kontrollera att allt är korrekt och att “index.php” i /public_html/wordpress/ ser på samma sätt som den gjorde när du började.
7. Nu loggar du in till admin, går till Inställningar -> Allmänt och ändrar “Bloggadress (URL)” till “http://yourbloghere.com”. (I “WordPressadress (URL)” ska det stå “http://yourbloghere.com/wordpress”)
8. Voilá! Surfa in på din blogg och ta en titt! =)











Johan Wigmo said:
Har använt den här guiden varje gång jag ska sätta upp en wp
Men nu upptäckte jag att du nog skrivit fel i den svenska beskrivningen. Du har en ” istället för en ‘ på punkt tre
Truedsson said:
Hej.
Trodde att jag hittat svaret på min fråga men kanske inte ändå?
-Jag har en simpel index.html som min första sida
för att från denna kunna hoppa till olika delar av servern bland annat till en underkatalog som heter /blog där jag har min WP installerad. Från vissa nät och datorer kan jag klicka mig vidare till min blog men från vissa så kommer det bara upp en fråga om jag vill spara en fil som visar sig vara delar av index.php. Det konstiga är att det verkar inte finnas koppling till vilken typ av webbläsare.
Kan det vara så att jag skall flytta index.php till www-rooten och göra de ändringar som du föreslagit ?
Häls
/M