mod_rewrite not redirecting!

RewriteEngine On
RewriteRule   ^/automobiles(/)$             /index.php?view=autos             [R=301,NC,QSA,L]

This should take http://www.example.com/automobiles and point it to http://www.example.com/index.php?view=autos, no?
LVL 6
trickyidiotAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

caterham_wwwCommented:
in httpd.conf
RewriteEngine On
RewriteRule   ^/automobiles/?$             /index.php?view=autos             [R=301,NC,QSA,L]

or in .htaccess files:

RewriteEngine On
RewriteRule   ^automobiles/?$             /index.php?view=autos             [R=301,NC,QSA,L]



/? stands for 0 or 1 slash. If you don't want an external redirect, drop "R=301," from the flags

0
trickyidiotAuthor Commented:
Got a big fat internal server error on that one

here's the full set of code from httpd.conf:
<Directory />
    Options FollowSymLinks
    AllowOverride All
		<IfModule mod_rewrite.c>
			RewriteEngine On
			RewriteCond   %{REQUEST_FILENAME} !-f
			RewriteCond   %{REQUEST_FILENAME} !-d
			#RewriteRule   ^/automobiles/?$ 			/index.php?view=autos 		[NC,L]
			#RewriteRule   ^/computing/?$ 				/index.php?categoryID=2953 	[NC,L]
			#RewriteRule   ^/electronics/?$ 			/index.php?categoryID=2721 	[NC,L]
			#RewriteRule   ^/mac/?$ 					/index.php?categoryID=2720 	[NC,L]
			#RewriteRule   ^/memory/?$ 					/index.php?categoryID=5013 	[NC,L]
			#RewriteRule   ^/mobilecomputing/?$ 		/index.php?categoryID=2719 	[NC,L]
			#RewriteRule   ^/officesupplies/?$ 			/index.php?categoryID=3816 	[NC,L]
			#RewriteRule   ^/traveler/?$ 				/index.php?view=traveler 	[NC,L]
			RewriteRule   ^(.*)$ /index.php?action=OldLinkConversion&queryString=$1 [QSA,L]
		</IfModule>
</Directory>

Open in new window

0
trickyidiotAuthor Commented:
I have the rules commented out as they caused the internal server error
0
caterham_wwwCommented:
That is directory context. I'd suggest - if possible - to place the rules outside of the <Directory> section with (code below). That would avoid internal redirects.

The rules are/were not the origin of the problem, but the conditions are on a wrong place. The order of processing is always rule-pattern --> condition(s) --> substitution. So the conditions above a rule are only applied for this specific rule, not for all rules below.
                        RewriteEngine On
                        RewriteRule   ^/automobiles/?$                         /index.php?view=autos           [NC,L]
                        RewriteRule   ^/computing/?$                           /index.php?categoryID=2953      [NC,L]
                        RewriteRule   ^/electronics/?$                         /index.php?categoryID=2721      [NC,L]
                        RewriteRule   ^/mac/?$                                         /index.php?categoryID=2720      [NC,L]
                        RewriteRule   ^/memory/?$                                      /index.php?categoryID=5013      [NC,L]
                        RewriteRule   ^/mobilecomputing/?$             /index.php?categoryID=2719      [NC,L]
                        RewriteRule   ^/officesupplies/?$                      /index.php?categoryID=3816      [NC,L]
                        RewriteRule   ^/traveler/?$                            /index.php?view=traveler        [NC,L]
                        RewriteCond   %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
                        RewriteCond   %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
                        RewriteRule   ^(.*)$ /index.php?action=OldLinkConversion&queryString=$1 [QSA,L]

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
trickyidiotAuthor Commented:
nail, head, some smashing involved - good carpenter.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.