Re: htaccess rewrite rule

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: Lisa Kachold
Date:  
To: Main PLUG discussion list
Subject: Re: htaccess rewrite rule
Hi

On Sun, Aug 21, 2011 at 9:12 PM, keith smith <> wrote:

>
>
> Hi,
>
> I'm helping a friend that has a pretty sophisticated htaccess file and my
> htaccess skills are limited.
>
> The link is in the form of http://www.domain.tld/state/city-content/
>
> The file to display is in the directory /state/
>
> The file name is city-content.php
>
> I've looked around at a couple tutorials and the Apache docs and it all
> looks like Greek to me.
>
> I'm inclined to write a rule something like RewriteRule
> ^/state/city-content/$ /state/ city-content.php [R=301,L] but that does not
> seem to work.
>
> Also I want the URL to not change.
>
> Any help with a rewrite rule would be very appreciated.
>




RewriteRule ^/state/city-content/$ /state/city-content/city-content.php
[R=301,L]

Basically it has three sections:
RewriteCond (Starts with ^ and ends with $
RewriteRule (the full patch and filename)
Tags (on the end in [ ] for types of rewrites)

Just make sure your path is correct based on DocumentRoot (defined in the
httpd.conf or vhost.conf file for a VirtualHost).

And look at your access_log and error_logs for clues.

Reference: http://borkweb.com/story/apache-rewrite-cheatsheet

>
> Thanks in advance!
>
>
>
>
> ------------------------
> Keith Smith
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>




--
(602) 791-8002 Android
(623) 239-3392 Skype
(623) 688-3392 Google Voice
**
HomeSmartInternational.com
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss