Solved

Need help with simple RewriteRule

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP Curl Multi-exec 13 72
How to analyze web traffic logs 10 111
htaccess file 3 88
ignore other .htaccess 2 59
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
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…

821 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