Having your weblog outside the WordPress directory
-
I installed the latest CVS today, wanting to get some work done on my site. I’ve installed WordPress in a /wordpress directory, to keep the root clean. Putting the index.php file in / works perfectly well, but you can’t point the site url to this location, because the admin part will fall apart (well, sort of).
Anyway, to get to the point, using a little hack you can keep both things working:
<pre>if(!preg_match(“/.*wordpress\/wp-admin.*/”, $_SERVER[‘REQUEST_URI’])){
$siteurl = preg_replace(“/(.*)\/wordpress(.*)/”, “$1$2”, $siteurl);
}</pre>
This will remove the /wordpress part of the site url, when you are not in the admin directory. If you are, the site url remains intact. In my code, replace wordpress by the directory in which you installed it.
This hack must be placed in wp-includes/wp-db.php on line 44 (right after $siteurl = preg_replace(‘|/+$|’, ”, $siteurl);
By the way, it would be a nice feature to specify a installation URI and a weblog URI (what this hack takes care of now).
- The topic ‘Having your weblog outside the WordPress directory’ is closed to new replies.