Showing posts with label WordPress. Show all posts
Showing posts with label WordPress. Show all posts

Tuesday, November 23, 2010

Change domain for multisite Wordpress

#1. I need to add this to wp-config.php
...............................................
//FIXME: do comment/remove these hack lines. (once the database is updated)
update_option('siteurl', 'http://www.mydomain.com' );
update_option('home', 'http://www.mydomain.com' );
...............................................
note: as for multisite I don't get the general setting option to change the URL there ?
#2. and then would need to transfer the files to the new server , and update-import the database ....
#3. and then if needed use the Search and replace plugin .... to change the post links used by my websites' blog user.

Is this all ? or is there any thing else ?
Will this leave the multisite settings undisturbed and working ?
Thanks again for your spontaneous help and reply , so I'm much a novice, but this transfer knowledge is very essential for me.

Thursday, October 28, 2010

Correct the WordPress site URLs

I accidentally changed the WordPress HOME and SITEURL to the root of my domain, which is pointing nowhere (default IIS start page) and I locked myself out of the WordPress admin.  After  a few minutes of research I managed to get the site running and login back to admin area again.

1. The first method is so easy so I figure I should give it a try:
->modify the wp-config.php file to add two lines:
define('WP_HOME','http://my.website.com/correctlocation');
define('WP_SITEURL,'http://my.website.com/correctlocation');
Problem: after you did above, the site is running and you will be able to login to the admin interface. However, the Home and site URL values are no longer available for editting (they are greyed out) through the general settings.

2. I restored the wp-config.php to it was and tried the second method. which works great.
->modify the current active theme's functions.php file, to add two lines right after <?php line:
update_option('siteurl','http://my.website.com/correctlocation');
update_option('home', 'http://my.website.com/correctlocation');
Site is running and had no problem to login, the general setting shows the correct urls for my site and home. save the change and logout.
**Important: Remove the two lines you just added from functions.php. Put the file back where it belongs. login and logout and everything should be fine.

3. there are other methods, like to edit directly in database. I did not try it. Hopefully I will not need it. Do a search "Changeing the site URL" in WordPress Codex will lead to more answers.

Wednesday, October 27, 2010

Theme, Template for one single install of WordPress

You can have a different Layout for Pages v.s. Posts v.s. the single home page of your blog site because the Template files can be different for each. The disadvantage I can think of, for sharing a single WordPress installation for both blog and CMS, is that you would have to limit yourself to a single Theme for both. You'll have to decide whether you can live with the same Theme for both the blog and main site. If so, you can have a single installation do both, and save yourself a lot of grief.
The same Theme really means the same CSS file for both. And a sharing of the header.php and footer.php files. Though, with some careful php coding, you can even work around those commonalities.

There’s a fundamental difference between using themes in a single WordPress intallation and the new WP 3.0 multisite. The themes you install (when enabled), are available to be used for ALL subdomain sites. So, if you customize your theme code for the main site (or a subdomain blog) – those changes will be in every site using that theme. This could be good or bad. Let’s say that you decide to add adsense code in the homepage of one theme. It would show on every site using that theme. If your intention was to have adsense ads on all the blogs on the network (because you can edit theme files and they can’t) – then this worked out just fine. But if you were using the theme on the home site only, and then another sub-blog user enabled it, they would have the theme with all the customizations you’ve made for just the home site.

However, there’s a way to enable a theme for just a blog(or site). Read this: http://wpmututorials.com/themes/enabling-a-theme-for-just-one-blog/

Configure Pretty Permalinks for WordPress on IIS 7+

Using Permalinks

Permalinks are the permanent URLs to your individual weblog posts, as well as categories and other lists of weblog postings. A permalink is what another weblogger will use to link to your article (or section), or how you might send a link to your story in an e-mail message. The URL to each post should be permanent, and never change — hence permalink.

Permalink Types

There are three basic types of WordPress permalinks:

Default: "Ugly"

The default looks like
http://example.com/?p=N
where N is the Post ID number. It works on all server environments, but it doesn't look as nice as some of the other options.

mod_rewrite: "Pretty Permalinks"

Using mod_rewrite or lighttpd you can produce much nicer permalinks (see Pretty Permalinks). There are many different formats, but the most common, and most versatile looks like
http://example.com/category/post-name/
or  http://example.com/year/month/day/post-name
Some people eliminate some or all of the date elements (day, month, year) to have a shorter permalink format.
Pretty permalinks are available under
  • Apache web server with the mod_rewrite module
  • Microsoft IIS 7+ web server with the URL Rewrite 1.1+ module and PHP 5 running as FastCGI
  • Microsoft IIS 6+ using ASAPI_Rewrite
  • Lighttpd using a 404 handler or mod_rewrite (see See Also)

PATHINFO: "Almost Pretty"

PATHINFO permalinks look very much like mod_rewrite permalinks but for one exception: they have /index.php inserted before them, like so:
http://example.com/index.php/yyyy/mm/dd/post-name/
Otherwise, they are the same as the "pretty" mod_rewrite permalinks, and are similarly flexible. Anything that mod_rewrite permalinks can do, PATHINFO permalinks can do, with the help of that /index.php part.
There is a helpful plugin that displays the type of permalinks being used and detailed information on the internal rewrite rules used by WordPress.

Choosing your permalink structure

In the Settings → Permalinks panel (Options → Permalinks before WordPress 2.5), you can choose one of the "common" structures or enter your own in the "Custom structure" field using the structure tags.
Please note: You never, ever put your site url in the permalinks slot. You must use one of the structure tags, or a combination of tags only.
%year% 
The year of the post, four digits, for example 2004
%monthnum% 
Month of the year, for example 05
%day% 
Day of the month, for example 28
%hour% 
Hour of the day, for example 15
%minute% 
Minute of the hour, for example 43
%second% 
Second of the minute, for example 33
%postname% 
A sanitized version of the title of the post (post slug field on Edit Post/Page panel). So “This Is A Great Post!” becomes this-is-a-great-post in the URI (see Using only %postname%). Starting Permalinks with %postname% is strongly not recommended for performance reasons..
%post_id% 
The unique ID # of the post, for example 423
%category% 
A sanitized version of the category name (category slug field on New/Edit Category panel). Nested sub-categories appear as nested directories in the URI. Starting Permalinks with %category% is strongly not recommended for performance reasons.
%tag% 
A sanitized version of the tag name (tag slug field on New/Edit Tag panel). Starting Permalinks with %tag% is strongly not recommended for performance reasons
%author% 
A sanitized version of the author name. Starting Permalinks with %author% is strongly not recommended for performance reasons

Using "Pretty" permalinks (IIS)


Permalinks without mod_rewrite

"Pretty" permalinks usually require mod_rewrite, and IIS (common on Windows servers) does not support mod_rewrite. (If you are using Apache 2.0.54, on Windows, mod_rewrite may work, provided it is enabled in apache\conf\httpd.conf.)
If you are using IIS 7 and have admin rights on your server, you can use Microsoft's URL Rewrite Module instead. Though not completely compatible with mod_rewrite, it does support WordPress's pretty permalinks. Once installed, open the web.config file in the WordPress folder and add the following rule to the system.webServer element
<rewrite>
    <rules>
        <rule name="Main Rule" stopProcessing="true">
            <match url=".*" />
            <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php/{R:0}" />
        </rule>
    </rules>
</rewrite>
There's a full installation guide on the IIS site.

Download URL Rewrite Module 2.0
  • English: WebPI / x86 / x64
  • Friday, October 22, 2010

    Allow LAN user to view locally installed Wordpress

    Instead of the localhost alias, changed the WordPress address (URL) and Blog address (URL) to the LAN ip address, which needs to be a static IP address.

    login to wp admin >Settings>general>change URLs> save changes.

    Thursday, October 21, 2010

    Enable Multiple sites in WordPress

    To enable this feature, simply open your wp-config.php file located in your WordPress root folder. Then add the following line anywhere in the file:
    define('WP_ALLOW_MULTISITE', true);
    Once you have done that, you should be able to access the network page from Tools » Network

    (WordPress 3.0)

    Change siteURL in wordpress

    WordPress stores two addresses inside the database. These determine where your blog files are, and where the main index is. On a normal install, these addresses are the same.
    There are two occasions where you will need to access the database to alter one or both of these settings:
    1. If you have tried to alter the Blog URL or WordPress URL in Settings, and an error has occurred.
    2. If you have moved to a domain/subdomain with a different name.
    BACKUP your database before you begin and store the backup off your site server, like on your hard drive. See: Backing Up Your Database.
    Edit wp-config.php

    It should be possible to fix the site URL using a new feature -
    Add these two lines to your wp-config.php, where “example.com” is the NEW location of your site.
    define(‘WP_HOME’,'http://example.com’);
    define(‘WP_SITEURL’,'http://example.com’);
    Change your IIS settings to reflect the new URL.

    Old way-- change in database
    Wordpress stores the host url in the database.  Open your wordpress db and open the table called "wp_options" (since you said you used web pi, you can download the database manager add-in to the IIS manager so you can open MySQL database from within IIS manager), and look for the record with the "option_name" field value of "siteurl".   The "option_value" field contains the host url that's being used for every wordpress object.  Change the base URL to your desired value (like wordpress.domain.com) and all objects like pictures and links will use the base URL you set in that record.