mod_rewrite rule question [message #173305] |
Sat, 02 April 2011 21:54 |
Corvet
Messages: 4 Registered: April 2011
Karma: 0
|
Junior Member |
|
|
I need set a mod_rewrite rule to map incoming .html and .htm requests to the
(new) real .php extensions.
The following example I find is for .html page: how to adjust rule for both
..html and .htm pages?
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php [NC]
thanks.
|
|
|
Re: mod_rewrite rule question [message #173309 is a reply to message #173305] |
Sun, 03 April 2011 00:05 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 4/2/2011 5:54 PM, Corvet wrote:
> I need set a mod_rewrite rule to map incoming .html and .htm requests to the
> (new) real .php extensions.
> The following example I find is for .html page: how to adjust rule for both
> .html and .htm pages?
>
> Options +FollowSymlinks
> RewriteEngine on
> RewriteRule ^(.*)\.html$ $1.php [NC]
>
>
> thanks.
>
Wrong newsgroup. This one is for php. Try an apache newsgroup, such as
alt.apache.configuration.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: mod_rewrite rule question [message #173314 is a reply to message #173305] |
Sun, 03 April 2011 02:50 |
Michael Fesser
Messages: 215 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
.oO(Corvet)
> I need set a mod_rewrite rule to map incoming .html and .htm requests to the
> (new) real .php extensions.
> The following example I find is for .html page: how to adjust rule for both
> .html and .htm pages?
>
> Options +FollowSymlinks
> RewriteEngine on
> RewriteRule ^(.*)\.html$ $1.php [NC]
RewriteRule ^(.*)\.html?$ $1.php [NC]
^
Micha
|
|
|
Re: mod_rewrite rule question [message #173316 is a reply to message #173314] |
Sun, 03 April 2011 10:12 |
Corvet
Messages: 4 Registered: April 2011
Karma: 0
|
Junior Member |
|
|
"Michael Fesser" <netizen(at)gmx(dot)de> wrote in message
news:p1ofp69bhpom8td4kvlt1carubjaglndl3(at)mfesser(dot)de...
> .oO(Corvet)
>
>> I need set a mod_rewrite rule to map incoming .html and .htm requests to
the
>> (new) real .php extensions.
>> The following example I find is for .html page: how to adjust rule for
both
>> .html and .htm pages?
>>
>> Options +FollowSymlinks
>> RewriteEngine on
>> RewriteRule ^(.*)\.html$ $1.php [NC]
>
> RewriteRule ^(.*)\.html?$ $1.php [NC]
> ^
> Micha
------
thanks for input. I just find also, another method would be:
RewriteRule ^(.*)\.(.htm|.html)$ $1.php [NC]
|
|
|
Re: mod_rewrite rule question [message #173318 is a reply to message #173316] |
Sun, 03 April 2011 11:07 |
Luuk
Messages: 329 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 03-04-2011 12:12, Corvet wrote:
>
> "Michael Fesser" <netizen(at)gmx(dot)de> wrote in message
> news:p1ofp69bhpom8td4kvlt1carubjaglndl3(at)mfesser(dot)de...
>> .oO(Corvet)
>>
>>> I need set a mod_rewrite rule to map incoming .html and .htm requests to
> the
>>> (new) real .php extensions.
>>> The following example I find is for .html page: how to adjust rule for
> both
>>> .html and .htm pages?
>>>
>>> Options +FollowSymlinks
>>> RewriteEngine on
>>> RewriteRule ^(.*)\.html$ $1.php [NC]
>>
>> RewriteRule ^(.*)\.html?$ $1.php [NC]
>> ^
>> Micha
> ------
>
> thanks for input. I just find also, another method would be:
>
> RewriteRule ^(.*)\.(.htm|.html)$ $1.php [NC]
>
you do mean:
RewriteRule ^(.*)\.(htm|html)$ $1.php [NC]
;)
--
Luuk
|
|
|
Re: mod_rewrite rule question [message #173319 is a reply to message #173318] |
Sun, 03 April 2011 11:30 |
Corvet
Messages: 4 Registered: April 2011
Karma: 0
|
Junior Member |
|
|
"Luuk" wrote:
>> ------
>>
>> thanks for input. I just find also, another method would be:
>>
>> RewriteRule ^(.*)\.(.htm|.html)$ $1.php [NC]
>>
>
> you do mean:
> RewriteRule ^(.*)\.(htm|html)$ $1.php [NC]
>
> ;)
>
> --
> Luuk
----------
yes, extra dots probably can be omitted.
Corvet
|
|
|
Re: mod_rewrite rule question [message #173320 is a reply to message #173319] |
Sun, 03 April 2011 11:44 |
Luuk
Messages: 329 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 03-04-2011 13:30, Corvet wrote:
>
> "Luuk" wrote:
>
>>> ------
>>>
>>> thanks for input. I just find also, another method would be:
>>>
>>> RewriteRule ^(.*)\.(.htm|.html)$ $1.php [NC]
>>>
>>
>> you do mean:
>> RewriteRule ^(.*)\.(htm|html)$ $1.php [NC]
>>
>> ;)
>>
>> --
>> Luuk
> ----------
>
> yes, extra dots probably can be omitted.
>
>
> Corvet
no, the SHOULD be ommited
see: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriterule
<quoot>
Some hints on the syntax of regular expressions:
Text:
. Any single character
Escaping:
\char escape the given char
</quoot>
Therefore:
\.(.html) will match a dot followed by any character followed by 'html'
\.(html) will match a dot followed by 'html'
--
Luuk
|
|
|
Re: mod_rewrite rule question [message #173326 is a reply to message #173320] |
Sun, 03 April 2011 13:04 |
Corvet
Messages: 4 Registered: April 2011
Karma: 0
|
Junior Member |
|
|
"Luuk" wrote:
>>>>
>>>> thanks for input. I just find also, another method would be:
>>>>
>>>> RewriteRule ^(.*)\.(.htm|.html)$ $1.php [NC]
>>>>
>>>
>>> you do mean:
>>> RewriteRule ^(.*)\.(htm|html)$ $1.php [NC]
>>>
>>> ;)
>>>
>>> --
>>> Luuk
>> ----------
>>
>> yes, extra dots probably can be omitted.
>>
>>
>> Corvet
>
> no, the SHOULD be ommited
>
> see: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriterule
> <quoot>
> Some hints on the syntax of regular expressions:
>
> Text:
> . Any single character
> Escaping:
> \char escape the given char
> </quoot>
>
> Therefore:
> \.(.html) will match a dot followed by any character followed by 'html'
> \.(html) will match a dot followed by 'html'
>
>
-------
Thanks a lot. The regular expressions is something difficult :)
|
|
|