Quantcast
Channel: BulletProof Security Forum » All Posts
Viewing all articles
Browse latest Browse all 12518

Reply To: htaccess redirect code – redirect old page to new page

$
0
0

My interpretation of what you want is basically you want to end up with redirected URL’s that point to this: http://www.domain.net/classifieds/ without the Query String on the URL correct? Or is there another folder involved called /ads/?

If what you want is to strip the Query String from the URL|URI then this is the code you want:

# Strips the do=contactus and do=detailpage Query Strings from the URL|URI
RewriteCond %{QUERY_STRING} ^do=contactus$ [NC,OR]
RewriteCond %{QUERY_STRING} ^do=detailpage(.*)$ [NC]
RewriteRule ^(.*)$ $1? [R=301,L]

Another Example of replacing Query Strings just for fun:

# Replaces Query Strings: do=contactus and do=detailpage with Query string: ?keywords=[keyword]
RewriteCond %{QUERY_STRING} ^do=contactus$ [NC,OR]
RewriteCond %{QUERY_STRING} ^do=detailpage(.*)$ [NC]
RewriteRule ^(.*)$ $1?keywords=[keyword] [R=301,L]

To add this custom code to BPS Root Custom Code these are the steps:

1.  Go to the BPS htaccess File Editor page, click on the Your Current Root htaccess File tab, scroll down in your Root .htaccess file code until you see this .htaccess code below (or similar code – may look slightly different than the code below).

# WP REWRITE LOOP START
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

2.  Copy your # WP REWRITE LOOP START code to this BPS Root Custom Code text box:  CUSTOM CODE WP REWRITE LOOP START
3.  After you have copied your WP Rewrite Loop Start .htaccess code to the Custom Code text box add your particular custom  htaccess redirect code.  Your code should look something like the example below.
4.  Click the Save Root Custom Code button.
5.  Go to the BPS Security Modes page, click the Create secure.htaccess File AutoMagic button and activate Root folder BulletProof Mode.

Example:

# WP REWRITE LOOP START
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# Strips the do=contactus and do=detailpage Query Strings from the URL|URI
RewriteCond %{QUERY_STRING} ^do=contactus$ [NC,OR]
RewriteCond %{QUERY_STRING} ^do=detailpage(.*)$ [NC]
RewriteRule ^(.*)$ $1? [R=301,L]
  • This reply was modified 12 hours, 44 minutes ago by  AITpro Admin.
  • This reply was modified 12 hours, 44 minutes ago by  AITpro Admin.
  • This reply was modified 10 hours, 18 minutes ago by  AITpro Admin.

Viewing all articles
Browse latest Browse all 12518

Trending Articles