Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old April 16th, 2008, 05:07 PM
JHouse JHouse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Fort Collins, CO
Posts: 230 JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 19 h 23 m 3 sec
Reputation Power: 7
general - Redirecting dynamic urls to static ones w/htaccess

Hi there,

I've been searching quite a bit for a solution, but thus far, none of them have worked properly.

I can redirect static urls to static urls just fine, but when I try and redirect an old dynamic url to a static one, it redirects, but it adds the query string to end of the url (i.e. www.nwcolorado.com/? or www.nwcolorado.com/?listingID=201).

I want to redirect:

http://www.nwcolorado.com/NWR_Listingview.php?listingID=201

to:

http://www.nwcolorado.com/

How would I accomplish this?

Also, is there a simple way to do this for all dynamic urls using "NWR_Listingview.php" as the base? Reason I ask is that there are several listings that need to be redirected to the home page.

Here's my htaccess file thus far:

Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 91.74.160.18

RewriteCond %{HTTP_HOST} ^nwcolorado.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.nwcolorado.com$

Redirect 301 /NWR_BuyingProcess.php http://www.nwcolorado.com/contact-us/
Redirect 301 /NWR_Buyingsellingtips.php http://www.nwcolorado.com/help-faq/real-estate-tips/
Redirect 301 /NWR_Contactus.php http://www.nwcolorado.com/contact-us/
Redirect 301 /NWR_Localphotogallery.php http://www.nwcolorado.com/local-information/fort-collins-photos/

Much thanks in advance.
__________________
JHouse
www.GroundedGroup.com

Reply With Quote
  #2  
Old April 17th, 2008, 01:57 AM
JHouse JHouse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Fort Collins, CO
Posts: 230 JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 19 h 23 m 3 sec
Reputation Power: 7
Just to be clear, I don't want to rewrite the old urls, I want to redirect them to the main domain. I'm throughly diving through the web looking for viable solutions, but still no luck.

I generally don't rush people for help, it's just that I took this client's site live recently and the search engine spiders are very active with it.

Thanks.

Reply With Quote
  #3  
Old April 17th, 2008, 10:46 AM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,124 jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 10 h 58 m 38 sec
Reputation Power: 717
Doing the redirect with mod_rewrite would probably remove the query string.

You could also just redirect in the NWR_Listingview.php PHP, no?
__________________
# Jeremy

Explain your problem instead of asking how to do what you decided was the solution.

Reply With Quote
  #4  
Old April 17th, 2008, 11:10 AM
JHouse JHouse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Fort Collins, CO
Posts: 230 JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 19 h 23 m 3 sec
Reputation Power: 7
Quote:
Originally Posted by jharnois
Doing the redirect with mod_rewrite would probably remove the query string.

You could also just redirect in the NWR_Listingview.php PHP, no?

Hi Jeremy,

Thanks for your help.

I tried putting the code below in the .htaccess file, but it didn't work. Is there something I'm doing wrong? :

Code:
RewriteRule ^NWR_Listingsearch.php$ http://www.nwcolorado.com/? [R=301,L]


Now my htaccess file is like this:

Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 91.74.160.18

RewriteRule ^NWR_Listingsearch.php$ http://www.nwcolorado.com/? [R=301,L]
Redirect 301 /NWR_BuyingProcess.php http://www.nwcolorado.com/help-faq/real-estate-tips/
Redirect 301 /NWR_Contactus.php http://www.nwcolorado.com/contact-us/
Redirect 301 /NWR_Localphotogallery.php http://www.nwcolorado.com/local-information/fort-collins-photos/


I don't want to redirect via the NWR_Listing.php page for SEO reasons, something I just learned late last night from one of Matt Cutts' videos (the head of Google's Webspam team).

Thanks.

Reply With Quote
  #5  
Old April 18th, 2008, 07:45 AM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,124 jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 10 h 58 m 38 sec
Reputation Power: 717
It should be ^NWR_Listingsearch\.php$ but that shouldn't prevent it from matching. You might add the NC (no case) flag, too.

Reply With Quote
  #6  
Old April 18th, 2008, 02:45 PM
JHouse JHouse is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Fort Collins, CO
Posts: 230 JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level)JHouse User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 19 h 23 m 3 sec
Reputation Power: 7
Quote:
Originally Posted by jharnois
It should be ^NWR_Listingsearch\.php$ but that shouldn't prevent it from matching. You might add the NC (no case) flag, too.


Thanks again for your continued support.

I tried what you suggested, minus the nc part for now, but no dice.

Here's what I have thus far:

Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 91.74.160.18

RewriteRule ^NWR_Listingview\.php$ http://www.nwcolorado.com/ [R=301,L]

Redirect 301 /NWR_BuyingProcess.php http://www.nwcolorado.com/help-faq/real-estate-tips/
Redirect 301 /NWR_Contactus.php http://www.nwcolorado.com/contact-us/
Redirect 301 /NWR_Localphotogallery.php http://www.nwcolorado.com/local-information/fort-collins-photos/

Reply With Quote
  #7  
Old April 21st, 2008, 07:19 AM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,124 jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level)jharnois User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 10 h 58 m 38 sec
Reputation Power: 717
I don't see any issues with your syntax. Your next step is to enable a RewriteLog, which requires access to httpd.conf, and to remove other directives to see how their existence affects your rule.

Note that without the NC flag, you must request NWR_Listingview.php case correctly or the RewriteRule will not match.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > general - Redirecting dynamic urls to static ones w/htaccess


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway