Solved

Need help with simple RewriteRule

Posted on 2008-10-28
2
234 Views
Last Modified: 2012-05-05
I'm trying to redirect all requests to www.mysite.com/fdc to www.mysite.com/products/fdc

The rewrite stuff from my .htaccess file is posted below.

I don't understand why the fdc RewriteRule (line 5 below) isn't working.  But, it only directs me to my 404 page.

Any ideas on how to get this working?  Also, how to make it case insensitive?   That way it'll direct from www.mysite.com/FDC as well.

Thanks for your help!!


CheckSpelling off

ErrorDocument 404 /404.php

RewriteEngine on

 

RewriteRule ^fdc$ /products/fdc/ #why isn't this working????

 

 

RewriteCond %{REQUEST_URI} !(\.[^./]+)$

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule (.*) /$1.php [L]

Open in new window

0
Comment
Question by:light_bulb
2 Comments
 
LVL 27

Accepted Solution

by:
caterham_www earned 500 total points
ID: 22821525
May be missing R-Flag? (NC = no case)

You may speed-up your last rule, the rule-pattern is being processed before conditions are applied.
CheckSpelling off

ErrorDocument 404 /404.php

RewriteEngine on

 

RewriteRule ^fdc$ /products/fdc/ [R=301,L,NC]

 

 

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule !(\.[^./]+)$ %{REQUEST_URI}.php [L]

Open in new window

0
 
LVL 3

Author Closing Comment

by:light_bulb
ID: 31510708
Perfect solution!

Thanks for the help.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now