![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Feb 2004
Posts: 350
|
.htaccess question - query sting param redirect
$10 epass and my eternal gratitude for a working solution:
I need to 301 redirect urls with a specific query string parameter (any value) to my main url. In other words: Code:
http://www.domain.com/index.php?cat=x http://www.domain.com/index.php?cat=whatever Code:
http://www.domain.com but Code:
http://www.domain.com/index.php?dir=x |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Mar 2004
Location: Rock Hill, SC
Posts: 5,370
|
why use htaccess to do that? why not just use php?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Industry Role:
Join Date: Mar 2004
Location: Rock Hill, SC
Posts: 5,370
|
put this at the top of your index.php
Certain values PHP Code:
Any Value PHP Code:
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: Feb 2004
Posts: 350
|
Yo, you're awesome for posting that, but no dice. I tried the code in index.php but it had no affect. This script has so many .php functions and external files - totally beyond my grasp. That's why I was hoping for a neat and tidy .htaccess fix.
Hit me up with your epass though! mcurtis313 at gmail dot com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: Aug 2007
Posts: 128
|
Code:
RewriteEngine on RewriteCond %{QUERY_STRING} ^cat=.*$ RewriteRule .* http://www.domain.com [R=301,L]
__________________
230-699 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 | |
Confirmed User
Join Date: Feb 2004
Posts: 350
|
Quote:
http://www.domain.com/?cat=x I want to kill the trailing slash and query string for the canonical URL. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Join Date: Aug 2007
Posts: 128
|
Okay, then change it to this:
Code:
RewriteEngine on RewriteCond %{QUERY_STRING} ^cat=.*$ RewriteRule .* http://www.domain.com? [R=301,L]
__________________
230-699 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Join Date: Feb 2004
Posts: 350
|
WINNER!
I've still got the trailing slash (www.domain.com/) but that's damn close. Hit me up with your epass ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Join Date: Aug 2007
Posts: 128
|
no epass needed. just hit me up if you need a programmer in the future.
note: even if you put the url in your browser without the trailing slash, you'll see it refresh WITH the slash.
__________________
230-699 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Join Date: Feb 2004
Posts: 350
|
You, sir, are the man. I will.
|
![]() |
![]() ![]() ![]() ![]() ![]() |