Solved

Need help with simple RewriteRule

Posted on 2008-10-28
2
236 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

773 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