Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Taro on "Re: Search result based on menu category"

$
0
0

Dear bcworkz,

The following "wp_redirect" i found in my function.php

<?php
add_action(‘template_redirect’, ‘bwp_template_redirect’);
function bwp_template_redirect()
{
if (is_author())
{
wp_redirect( home_url() ); exit;
}
}

function author_archive_redirect() {
   if( is_author() ) {
       wp_redirect( home_url(), 301 );
       exit;
   }
}
add_action( 'template_redirect', 'author_archive_redirect' );

/*remove wordpress version number from front-end pages*/
function remove_version_from_mysite() {
  return '';
}
add_filter('the_generator','remove_version_from_mysite');
add_filter('generator','remove_version_from_mysite');
?>
// go to region home page if a home page request from same site
// region determined from referrer URL
add_action('init', 'tg_home_by_region');
function tg_home_by_region( $query ) {
  if ( array_key_exists('HTTP_REFERER', $_SERVER ) && 0 === strpos( $_SERVER['HTTP_REFERER'], site_url('/'))) {
    $explode = explode('/', $_SERVER['HTTP_REFERER']);
    $region = $explode[3];
    if ( "/$region/" != $_SERVER['REQUEST_URI'] && '/' == $_SERVER['REQUEST_URI']) {
      wp_redirect( site_url("/$region/"));
      exit;
    }
  }
}

the following is in my htaccess file

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^*****/?$ /wp-login.php [QSA,L]
RewriteRule ^*****/register/?$ /wp-login.php?action=register [QSA,L]
RewriteRule ^*****/lostpassword/?$ /wp-login.php?action=lostpassword [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
RewriteCond %{REQUEST_URI} !^/wp-content/plugins/file/to/exclude\.php
RewriteCond %{REQUEST_URI} !^/wp-content/plugins/directory/to/exclude/
RewriteRule wp-content/plugins/(.*\.php)$ - [R=404,L]
RewriteCond %{REQUEST_URI} !^/wp-content/themes/file/to/exclude\.php
RewriteCond %{REQUEST_URI} !^/wp-content/themes/directory/to/exclude/
RewriteRule wp-content/themes/(.*\.php)$ - [R=404,L]

Viewing all articles
Browse latest Browse all 8245

Trending Articles