Maritime_pi
Posts: 8
Joined: Fri Jan 24, 2014 2:42 am

config for Apache for my domain URL

Sun Mar 16, 2014 4:54 am

I am looking for a way for my apache server to redirect a port 80 request for my domain URL to the wordpress webpage. For example, I have to type in mydomainname.com/wordpress to get to my webpage on my pi. I'd like to have the apache server forward any port 80 request to the /wordpress site instead of users having to type /wordpress after my domain name. Is there a way to have this capability on my pi's apache server?

Don

ThomasS
Posts: 118
Joined: Thu Jan 23, 2014 7:05 pm
Location: Leeds
Contact: Website

Re: config for Apache for my domain URL

Sun Mar 16, 2014 7:28 am

Why do you have to type /wordpress? Why not just put WordPress in the root folder of your server? I'm not sure whether the pi could do this, and if it could it would be considerably slower than your existing server. You could use your pi as the sole server, but you'd still have the speed problem.
ThomasS

User avatar
DougieLawson
Posts: 38449
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: config for Apache for my domain URL

Sun Mar 16, 2014 10:00 am

You may be able to use something like this

Code: Select all

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>

# END WordPress
Note that's not tested, because I have no desire to install wordpress on any of my systems.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

I'll do your homework for you for a suitable fee.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

montyjanderson
Posts: 2
Joined: Sun Mar 16, 2014 10:07 am
Contact: Website

Re: config for Apache for my domain URL

Sun Mar 16, 2014 4:53 pm

You could just put index.php in the root and write:

Code: Select all

<?php
header("Location: http://[yourdomain]/wordpress/");
?>
Although, it's probably easier to set the documentroot in apache.
It's not tested, but you might be able to put this in a .htaccess file (in the root).

Code: Select all

DocumentRoot /var/www/wordpress
montyjanderson's Raspberry Pis
Raspberry Pi 256mb + Apache 2.2 + MySQL + Wordpress
Raspberry Pi 512mb + Minecraft Server

Maritime_pi
Posts: 8
Joined: Fri Jan 24, 2014 2:42 am

Re: config for Apache for my domain URL

Mon Mar 17, 2014 12:19 am

Thank you. Got it working easily with montyjanderson's index.php

Many thanks

Return to “Advanced users”