Forum Moderators: phranque

Message Too Old, No Replies

Simple mod rewrite question

Some simple advice!

         

tomupton

1:26 pm on Jul 30, 2012 (gmt 0)

10+ Year Member



Hi Guy's,

Ive been working on this all night and im hoping someone can help here!

Below is my .htaccess file, what im trying to achieve is that certain pages within my site are dynamically created, so for example my urls are looking like this:

[localhost...]

The problem is some of my standard pages (no dynamic) are displayed like this - [localhost...] - as you can see they have an extension of .php at the end.

What i would ideally like is to have this url end in .php - [localhost...]

Below is my code, any help would be fab!
Regards
Tom

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteRule ^([A-Z­a-z­0-9­-]+)/?$ SkinProject/page.php?seo_link=$1 [L]

lucy24

3:56 pm on Jul 30, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Moderators, can't I please use the "rolling on the floor laughing hysterically" emoticon just this once? Pleeeeease?

Tom, you overlooked the Sticky post-- as well as the generic Forums charter-- about using "example.com" in all, er, examples. And also the rule about not linking to yourself. But you are forgiven because the link is to "localhost".

Now, then.

:: peering into crystal ball ::

When you say "What i would ideally like is to have this url end in .php" you mean "NOT end in .php" --and then serve content from the "real" page, which does end in php and comes with an unattractive query string. In other words, the basic redirect-to-rewrite two-step.

Fortunately, this question has come up several times a week over the past, uhm, is it ten years this forum has been in existence? So a quick crawl through earlier threads should quickly point you in the right direction.

Oh, wait. Question was addressed to "guys". Never mind, then.

g1smd

9:54 pm on Jul 30, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This pattern with optional trailing slash:
^([A-Z­a-z­0-9­-]+)/?$

ensures you will have duplicate content problems on your site.

The URL for a page should NOT have a trailing slash.


Use example.com in this forum to suppress auto-linking.