Move WP from subdir to root dir

From askwpgirl.com

Q. I’ve installed my website in a subdirectory of our domain, because I didn’t want visitors to see the site until I was finished with our development.
Now I want to have the site show up in the root directory (not in the http://mydomain.com/wordpress directory). How do I do this? I’ve read the information on moving WordPress, and it seems really complicated.

A. The good news is that you DO NOT need to MOVE WordPress in order to have your content display without the subdirectory name. You only need to move 1 file and change one line of code and make one modification to your General Settings, and you’re good to go (see instructions below).

Installing WordPress in a subdirectory is good idea because:

It keeps your root directory clean and tidy (in case you need to add any other PHP applications to your site).
It adds another layer of security by obscuring the location of your WordPress application files. Ideally, you want to name the subdirectory something not too obvious (ie don’t call it wp or WordPress).

It allows you to develop a new WordPress site while maintaining your current website in the root directory. Once you’re finished with your WordPress development, you can backup and then delete your current site’s files, and use the following instructions to display WordPress from the root directory of the site.

“Moving” WordPress from Subdirectory to the Site’s Root Directory

1. Install WordPress as you normally would, but instead of installing it in the root directory (ie in the www or public_html directory), install it in a subdirectory in the www or public_html folder.

2. Once you’ve completed your design work, adding pages to the site, etc., login to the WordPress Dashboard. From the Settings -> General tab, set your WordPress address URL to the subdirectory you installed WordPress in (without the trailing slash). Note: This will already be displayed in the WordPress address field, so you don’t have to change it. What you do need to change is the Site address URL. Set this to your site’s root address (without the trailing slash).

3. Next, MOVE (do not copy) the index.php file that is in the WordPress application directory to the root directory. You can usually do this in an FTP application by selecting the file and choosing Move. (Do not move the index.php file in the themes folder or any other folder.) (Note: If you have a site already in the root directory, such as an old static html site, then you should backup and delete those files first.)

4. In a text or HTML editor, open the index.php file that you just moved and change the location of your wp-blog-header.php to the new location.
Example: if your WordPress installation folder is ‘mywp’, you would change:
< ?php require('./wp-blog-header.php'); ?>
to
< ?php require('./mywp/wp-blog-header.php'); ?>

5. Visit the site and click an interior page to make sure it displays correctly. If it doesn’t, you may need to update your permalinks (Settings -> Permalinks and click Save Changes). If you still cannot access your interior pages, then the .htaccess may need to be moved to the same location as the index.php file (i.e. the root directory). This is not necessary on all web hosts. Be sure to update the permalinks again after you move the .htaccess file.

Remember that your login and registration links will still be
http://www.yoursite.com/mywp/wp-login.php.

Now, when people visit your site, they will see all the URLs of all the pages and posts as if you had installed WordPress in the root directory, and you will have a neat WordPress directory behind the scenes.

From askwpgirl.com

Glark

From Linux.com
By Joe ‘Zonker’ Brockmeier

GNU grep is one of my go-to tools on any Linux box. But grep isn’t the only tool in town. If you want to try something a bit different, check out glark a grep alternative that might might be better in some situations.

What is glark? Basically, it’s a utility that’s similar to grep, but it has a few features that grep does not. This includes complex expressions, Perl-compatible regular expressions, and excluding binary files. It also makes showing contextual lines a bit easier. Let’s take a look.

I installed glark (yes, annoyingly it’s yet another *nix utility that has no initial cap) on Linux Mint 11. Just grab it with apt-get install glark and you should be good to go. Simple searches work the same way as with grep: glark string filenames. So it’s pretty much a drop-in replacement for those. But you’re interested in what makes glark special. So let’s start with a complex expression, where you’re looking for this or that term:

glark -r -o thing1 thing2 *

This will search the current directory and subdirectories for “thing1” or “thing2.” When the results are returned, glark will colorize the results and each search term will be highlighted in a different color. So if you search for, say “Mozilla” and “Firefox,” you’ll see the terms in different colors. You can also use this to see if something matches within a few lines of another term. Here’s an example:

glark --and=3 -o Mozilla Firefox -o ID LXDE *

This was a search I was using in my directory of Linux.com stories that I’ve edited. I used three terms I knew were in one story, and one term I knew wouldn’t be. You can also just use the –and option to spot two terms within X number of lines of each other, like so:

glark --and=3 term1 term2

That way, both terms must be present. You’ll note the –and option is a bit simpler than grep’s context line options. However, glark tries to stay compatible with grep, so it also supports the -A, -B and -C options from grep. Miss the grep output format? You can tell glark to use grep format with the –grep option. Most, if not all, GNU grep options should work with glark.

Before and After

If you need to search through the beginning or end of a file, glark has the –before and –after options (short versions, -b and -a). You can use these as percentages or as absolute number of lines. For instance:

glark -a 20 expression *

That will find instances of expression after line 20 in a file.

The glark Configuration File

Note that you can have a ~/.glarkrc that will set common options for each use of glark (unless overridden at the command line). The man page for glark does include some examples, like so:


after-context: 1
before-context: 6
context: 5
file-color: blue on yellow
highlight: off
ignore-case: false
quiet: yes
text-color: bold reverse
line-number-color: bold
verbose: false
grep: true

Just put that in your ~/.glarkrc and customize it to your heart’s content. Note that I’ve set mine to grep: false and added the binary-files: without-match option. You’ll definitely want the quiet option to suppress all the notes about directories, etc. See the man page for more options. It’s probably a good idea to spend about 10 minutes on setting up a configuration file.

Final Thoughts

One thing that I have noticed is that glark doesn’t seem as fast as grep. When I do a recursive search through a bunch of directories containing (mostly) HTML files, I seem to get results a lot faster with grep. This is not terribly important for most of the stuff I do with either utility. However, if you’re doing something where performance is a major factor, then you may want to see if grep fits the bill better.

Is glark “better” than grep? It depends entirely on what you’re doing. It has a few features that give it an edge over grep, and I think it’s very much worth trying out if you’ve never given it a shot.

From Linux.com

One more thing, Glark can be installed on a Cent/Redhat server using
gem install glark

daily reboot via cron

Not saying this is a good idea, but a client requested it… 0_o

Here is crontab -e
### Reboot the server every day at 3:00 am
0 3 * * * /sbin/shutdown -r now >/dev/null

or, if the want to call a reboot from script:

Here is reboot_server.sh
#!/bin/bash
/sbin/shutdown -r now

Dig multiple cpanel domains

If you find yourself with a customer requesting to know where all the domains associated with a cpanel account are pointing to or are migrating accounts, you can do the following:


#for each in `ls /var/cpanel/users/*`; do grep DNS $each >> domains.txt; done;
#sed -i 's:.*DNS.*\=::gi' domains.txt ;
#for each in `cat domains.txt`; do echo "doing a dig on $each"; dig $each | grep -E "^$each.*\b(A|CNAME).*\..*\..*" ; echo ""; done;

The output will be something similar to;

doing a dig on cavemantech.net
cavemantech.net. 13970 IN A 68.180.131.16

doing a dig on cave.cavemantech.net
cave.cavemantech.net. 13970 IN A 68.180.131.16

doing a dig on training.cavemantech.net
training.cavemantech.net. 13970 IN A 68.180.131.16

doing a dig on wordpress.cavemantech.net
wordpress.cavemantech.net. 13970 IN A 68.180.131.16

doing a dig on roundcube.cavemantech.net
roundcube.cavemantech.net. 13970 IN A 68.180.131.16

doing a dig on confluence.cavemantech.net

doing a dig on dino.cavemantech.net
dino.cavemantech.net. 13970 IN A 68.180.131.16

Also if you need multiple queries for a specific record:
#dig example.com ns another.com ns

or if all records are needed:

#dig example.com any another.com any
which returns non-label (resource records) RRs for both domains

# dig example.com another.com any
which returns A (resource records) RR for 1st and non-label (resource records) RRs for 2nd domain

# dig example.com any another.com
which returns non-label (resource records) RRs for 1st and A (resource records) RR for 2nd

Apt-Undo

From From http://lkubuntu.wordpress.com

Apt-Undo, a simple way of undoing Apt actions

I have done many actions with apt-get that I later regretted, so I decided to make a script to undo those actions. This script can only work if you use this script instead of apt-get to install/upgrade/remove/purge/downgrade your packages.

To install, open up a Terminal window, and type in it:

sudo add-apt-repository ppa:lkjoel/apt-undo && sudo apt-get update; sudo apt-get install apt-undo

Usage examples:

apt-undo install yourpackages
apt-undo remove yourpackages
apt-undo purge yourpackages
apt-undo upgrade
apt-undo dist-upgrade
apt-undo install yourpackages=old.version
apt-undo install yourpackages=new.version

To undo:

apt-undo undo

# Or
apt-undo undo $HOME/.aptundo/year/month/date/yearmonthdatehourminutesseconds
# Or
bash $HOME/.aptundo/year/month/date/yearmonthdatehourminutesseconds