Přesměrování na specifickou verzi mobilního zařízení

/—code php
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/m/.*$
RewriteCond %{HTTP_ACCEPT} „text/vnd.wap.wml|application/vnd.wap.xhtml+xml“ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} „acs|alav|alca|amoi|audi|aste|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-“ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} „dang|doco|eric|hipt|inno|ipaq|java|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-“ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} „maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|opwv“ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} „palm|pana|pant|pdxg|phil|play|pluc|port|prox|qtek|qwap|sage|sams|sany“ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} „sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo“ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} „teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|w3cs|wap-|wapa|wapi“ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} „wapp|wapr|webc|winw|winw|xda|xda-“ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} „up.browser|up.link|windowssce|iemobile|mini|mmp“ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} „symbian|midp|wap|phone|pocket|mobile|pda|psp“ [NC]
#————- The line below excludes the iPad
RewriteCond %{HTTP_USER_AGENT} !^.*iPad.*$
#————-
RewriteCond %{HTTP_USER_AGENT} !macintosh [NC] #*SEE NOTE BELOW
RewriteRule ^(.*)$ /m/ [L,R=302]
\—

Problém s přesměrováním na jinou stránku

Potřebujeme-li v šabloně/pluginu/funkci přesměrovat výstup na jinou stránku, pomocí funkce „wp_redirect“:http://codex.wordpress.org/Function_Reference/wp_redirect nebo přímo přes „header(‚Location: http://www.example.com/‘)“:http://php.net/manual/en/function.header.php, může nastat problém, signalizovaný hláškou **Cannot modify header information – headers already sent by**.

Lze to vyřešit několika způsoby:

1) v php funkcí „ob_start“:http://php.net/manual/en/function.ob-start.php; zde „vysvětlení“:http://brian.moonspot.net/php-ob-start-headers

/—code php
// hned na začátek za úvodní umístíme
ob_end_flush();
?>
\—

2) javascriptem přes „window.location“:http://www.jakpsatweb.cz/javascript/objekt-window.html#location
/—code php



\—

3) pomocí „meta-refresh“:http://www.jakpsatweb.cz/presmerovani.html#meta
/—code php
„; ?>
\—

Přesměrování stránek nebo příspěvků na jinou adresu

**Quick Page/Post Redirect Plugin**
„http://wordpress.org/extend/plugins/quick-pagepost-redirect-plugin/“:http://wordpress.org/extend/plugins/quick-pagepost-redirect-plugin/
„http://www.fischercreativemedia.com/wordpress-plugins/quick-pagepost-redirect-plugin/“:http://www.fischercreativemedia.com/wordpress-plugins/quick-pagepost-redirect-plugin/

Redirect Pages or Posts to another location quickly.

It adds an option box to the page or post edit section where you can specify the redirect location and type of redirect that you want, temporary, permanent, or meta. The redirect Location can be to another WordPress page/post or any other website or external URL. It allows the use of a full URL path, post or page ID, permalink or page-name. Additional 301 Redirects can also be added for non-existent posts or pages – helpful for sites converted to WordPress where you don’t have the ability to edit the .htaccess file.

S výhodou lze využít když potřebujeme do navigace mezi ostatní stránky dostat obsah nějaké rubriky. Zřídíme stránku a přesměrujeme ji na obsah rubriky.

*Alternativy:*

**Simple Redirect**
„https://wordpress.org/plugins/simple-redirect/“:https://wordpress.org/plugins/simple-redirect/

Easily redirect any post or page to another page with a dropdown menu or by manually typing in a URL.

**Page Links To**
„http://wordpress.org/extend/plugins/page-links-to/“:http://wordpress.org/extend/plugins/page-links-to/
„http://txfx.net/wordpress-plugins/page-links-to/“:http://txfx.net/wordpress-plugins/page-links-to/

This plugin allows you to make a WordPress page or post link to a URL of your choosing, instead of its WordPress page or post URL. It also will redirect people who go to the old (or “normal”) URL to the new one you’ve chosen (301 Moved Permanently redirects are standard, but you can choose a 302 Moved Temporarily redirect if you wish).

This functionality is useful for setting up navigational links to non-WordPress sections of your site or to off-site resources.

You can also use it to create a hand-crafted menu that links to pages, posts, categories, or anything within your site.

**Redirect by Custom Field**
„http://wordpress.org/plugins/redirect-by-custom-field/“:http://wordpress.org/plugins/redirect-by-custom-field/

This plugin lets you easily create such „redirecting“ posts or pages by simply setting a custom field.

Usage: Add the custom field with label „redirect“ to any post or page. Enter the redirect target URL as the value of that custom field. Now all links on your site to that post or page will be replaced with that redirect URL! If you try to visit the permalink URL for that page, it will redirect the user to that redirect URL too.

The strings %home% and %site% in URLs are replaced by the WordPress home URL and site URLs.