Forum Moderators: phranque

Message Too Old, No Replies

mod-rewrite 301 redirect with 2 underscores

         

DuckTapeCoder1

11:52 pm on Jan 9, 2009 (gmt 0)

10+ Year Member



I having issues with a redirect that has a directory with multiple underscores. Would appreciate some advice!

I can't seem to get this to work? Is there a rule for directories with multiple underscores?

RewriteEngine On

RewriteRule ^higher_level_program/learn_more\.php$ [mysite.com...] [R=301,L]

g1smd

1:52 am on Jan 10, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In what way does it "not work"?

"Not work" could be almost *anything*.

DuckTapeCoder1

3:47 pm on Jan 10, 2009 (gmt 0)

10+ Year Member



True! It doesn't redirect the page to the new page. I'm trying to redirect traffic to a new page in a new directory.

jdMorgan

4:20 pm on Jan 10, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you have any other mod_rewrite code in this file that works?
What is the location of this .htaccess file?
Did you check your server error log?
What version of Apache are you running?

Jim

[edited by: jdMorgan at 4:20 pm (utc) on Jan. 10, 2009]

DuckTapeCoder1

5:34 pm on Jan 10, 2009 (gmt 0)

10+ Year Member



I have several rewrite codes that work, which is the strange thing. The file is located in my root folder. I'm a novice, so I have no clue where my error log is or what version I have. Its your basic Net Solutions hosting account.

wildbest

6:03 pm on Jan 10, 2009 (gmt 0)

10+ Year Member



I don't see any obvious reason. You may wish to separate this rule from the rest mod_rewrite rewrites by "#" like this:

#
RewriteRule ^higher_level_program/learn_more\.php$ [mysite.com...] [R=301,L]
#

jdMorgan

7:27 pm on Jan 10, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I suggest you contact your host to get the location of your error log file if you don't know where it is and can't find it in the FTP view of your site's files. You are not going to have much luck with .htaccess or scripting without access to that critical file.

You can usually see your server version by using the "Live HTTP Headers" add-on for Firefox and Mozilla browsers. The server info is usually included in every response to any HTTP request to your server. This add-on should be part of any Webmaster's basic toolkit.

If you have other rules in this same .htaccess file that work, the path to this .htaccess file is "example.com/.htaccess", and the "old" URL is "example.com/higher_level_program/learn_more\.php", then the likely problem is that some other rule preceding this one also matches the "old URL" and rewrites it before you ever get to this rule. There isn't anything wrong with the rule you posted, so the problem is elsewhere.

Jim