htaccess rewrite rule

Lisa Kachold lisakachold at obnosis.com
Mon Aug 22 13:44:07 MST 2011


Hi

On Sun, Aug 21, 2011 at 9:12 PM, keith smith <klsmith2020 at yahoo.com> 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 - PLUG-discuss at lists.plug.phoenix.az.us
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20110822/b3b104a3/attachment.html>


More information about the PLUG-discuss mailing list