Forum Moderators: phranque

Message Too Old, No Replies

301 redirect help please

         

karter2

3:22 pm on Oct 11, 2010 (gmt 0)



Hi All

I can achieve the basic

redirect 301 /oldpage /newpage.asp

However, i was trying out

RewriteEngine on
RewriteRule ^/([A-Za-z]+)$ http://www.example.com/$1/pro/index.asp [L/R=301]

bsically, trying to get

/directory/greenwidget

to

http://www.example.com/directory/greenwidget/pro/index.asp

The patern always remaining the same

The code above causes Server 500 error

please help

g1smd

6:05 pm on Oct 11, 2010 (gmt 0)

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



The redirect rematches the pattern, and redirects again in an infinite loop. Make the pattern more specific so that cannot happen.

Don't include the index.asp filename in the target path.

The flags need a comma, so it is [R=301,L] here.

karter2

6:57 pm on Oct 11, 2010 (gmt 0)



hi gsmd, sadly i gotta have the index.asp as this is a .net application, actually, its index.aspx, an without the .aspx , it doesn't trigger the application file

How do you mean more specific ?

For now i'll try

RewriteEngine on
RewriteRule ^/([A-Za-z]+)$ http://www.example.com/$1/pro/index.aspx [R=301,L]

karter2

7:09 pm on Oct 11, 2010 (gmt 0)



Well, now it just ignores the code :)

g1smd

7:49 pm on Oct 11, 2010 (gmt 0)

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



In .htaccess the leading slash must be omitted from the pattern.

jdMorgan

5:05 pm on Oct 15, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




RewriteEngine on
RewriteRule ^([A-Za-z]+)$ http://www.example.com/$1/pro/index.aspx [R=301,L]

-or-
 # Define all possible directory index filenames
DirectoryIndex index.php index.html index.htm index.shtm index.htm index.cgi index.asp
#
RewriteEngine on
RewriteRule ^([A-Za-z]+)$ http://www.example.com/$1/pro/ [R=301,L]

-or-
in /.htaccess

RewriteEngine on
RewriteRule ^([A-Za-z]+)$ http://www.example.com/$1/pro/ [R=301,L]
-and-
in /<all>/pro/.htaccess

DirectoryIndex index.asp

Jim