Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Old 07-30-2009, 02:16 AM   #1 (permalink)
Junior Member
 
Join Date: 07-30-09
Posts: 3
iTrader: 0 / 0%
Latest Blog:
None

futura is liked by many
.htaccess Redirect 301 rule

Hi,
I'm setting 301 Redirects in the .htaccess of a website.

I need to redirect a dynamic url like this:
http://www.mysite.com/en/details_lin...7639&navpage=1
to http://www.mysite.com
The catnavid and the navpage values can change.

I've put in the .htaccess:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ en/details_links_en\.php\?catnavid(.*)&navpage=(.*)\ HTTP/
RewriteRule ^en/details_links_en\.php$ http://www.mysite.com? [R=301,L]

But it doesn't work.
Can anyone help me?
Where am I going wrong?

Thanks!

Last edited by futura; 07-30-2009 at 02:20 AM..
futura is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-02-2009, 05:49 AM   #2 (permalink)
Junior Member
 
Join Date: 12-05-08
Posts: 18
iTrader: 0 / 0%
Latest Blog:
None

genetrix is liked by many
Good day to you ,
you can check out htaccess examples http://glurt.com/htaccess-file-tips-and-tricks
Hope it will help in your trouble
genetrix is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-03-2009, 06:10 AM   #3 (permalink)
Junior Member
 
Join Date: 08-03-09
Posts: 2
iTrader: 0 / 0%
Latest Blog:
None

premiumscripts is liked by many
Just have these two lines and it should work:

Code:
RewriteEngine on RewriteRule ^en/details_links_en.php http://www.mysite.com [R=301,L]
premiumscripts is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-03-2009, 10:30 AM   #4 (permalink)
Contributing Member
 
JennyRipley's Avatar
 
Join Date: 08-03-09
Posts: 392
iTrader: 0 / 0%
Latest Blog:
None

JennyRipley is liked by many
Good day to you.
You can do it follow the instructions:
RewriteEngine on
RewriteRule ^en/details_links_en.php$ http://www.mysite.com [R=301,L]
JennyRipley is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-03-2009, 12:55 PM   #5 (permalink)
Contributing Member
 
00joe's Avatar
 
Join Date: 03-17-09
Location: San Francisco, CA
Posts: 69
iTrader: 0 / 0%
Latest Blog:
None

00joe is liked by many
Make sure your hosting provider supports mod_rewrite in .htaccess
00joe is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-05-2009, 10:04 AM   #6 (permalink)
Junior Member
 
Join Date: 07-30-09
Posts: 3
iTrader: 0 / 0%
Latest Blog:
None

futura is liked by many
Hi, thanks to all but I still can't make it work.

I tried to put a

Redirect 301 /catnavid=7639&navpage=1 http://www.mysite.com/

and as a result when I click on
http://www.mysite.com/en/details_lin...7639&navpage=1

I get redirected to:
http://www.mysite.com/?catnavid=7639&navpage=1

Can anyone help me solving it?
Thank you!
futura is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-05-2009, 10:32 AM   #7 (permalink)
Super Moderator
 
htmlbasictutor's Avatar
 
Join Date: 10-29-07
Location: British Columbia, Canada
Posts: 3,215
iTrader: 0 / 0%
Latest Blog:
Website Testing

htmlbasictutor is a highly respected web prohtmlbasictutor is a highly respected web prohtmlbasictutor is a highly respected web prohtmlbasictutor is a highly respected web prohtmlbasictutor is a highly respected web prohtmlbasictutor is a highly respected web prohtmlbasictutor is a highly respected web prohtmlbasictutor is a highly respected web prohtmlbasictutor is a highly respected web prohtmlbasictutor is a highly respected web prohtmlbasictutor is a highly respected web pro
Read these and see if they help:
301 Permanent Redirect
Basic 301 Permanent Redirect

301 Permanent Redirect
__________________
HTML Basic Tutor - Learn to code your web pages/blogs
Basic Computer Information - Computer Basics for website owners

Trouble getting indexed? Maybe it's something techincal - Pm me.
htmlbasictutor is online now  
Add Post to del.icio.us
Reply With Quote
Old 08-05-2009, 10:39 AM   #8 (permalink)
Contributing Member
 
00joe's Avatar
 
Join Date: 03-17-09
Location: San Francisco, CA
Posts: 69
iTrader: 0 / 0%
Latest Blog:
None

00joe is liked by many
Try

Redirect 301 (.*)/catnavid=7639&navpage=1$ http://www.mysite.com/
00joe is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-05-2009, 10:53 AM   #9 (permalink)
Junior Member
 
Join Date: 07-30-09
Posts: 3
iTrader: 0 / 0%
Latest Blog:
None

futura is liked by many
Thank you.
I've tried but it doesn't work.
It gives me a 404 error and still redirects me to
http://www.mysite.com/?catnavid=7640&navpage=1
....
futura is offline  
Add Post to del.icio.us
Reply With Quote
Old 08-05-2009, 11:22 AM   #10 (permalink)
Contributing Member
 
00joe's Avatar
 
Join Date: 03-17-09
Location: San Francisco, CA
Posts: 69
iTrader: 0 / 0%
Latest Blog:
None

00joe is liked by many
Sorry if you use the syntax the way I wrote it you need RedirectMatch

RedirectMatch 301 (.*)/catnavid=7639&navpage=1$ http://www.mysite.com/

Things to check:
1. is mod_rewrite enabled for htaccess (its not by default)
2. its best to edit them on the server with VI. Windows editors may add special charaters
3. If the server is windows it won't work
00joe is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply

Tags
301, htaccess, redirect, regex


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conflict, What is the right htaccess rule, default homepage file with htaccess? basketmen Coding Forum 2 01-20-2009 08:50 AM
how to use htaccess for SSL redirect? jeremynet Coding Forum 1 12-06-2008 11:02 PM
.htaccess 301 redirect modine Coding Forum 14 06-12-2007 12:28 PM
htaccess 301 redirect esiason14 Coding Forum 2 01-31-2007 12:44 PM
.htaccess redirect problem..! Immo Coding Forum 16 08-03-2006 05:02 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 06:10 AM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.