Apache HTTP mod_rewrite

Apache HTTP mod_rewrite

am 10.04.2008 05:23:14 von Rz

Hey All,

I am having issues with my regex in mod_rewrite.

I am trying to change my web sites URL format from this:
http://localhost/?section=sitemap
to this:
http://localhost/sitemap

The new format is working great at changing the new incoming URL
format from this http://localhost/sitemap to my index.php.

But I am having issues writing the old URL format (?section=sitemap)
to the new URL format (/sitemap).

Can someone please help if you have time?

Below are the regex's I am using right now at are working great.

RewriteEngine On
RewriteRule ^.*\.css$ - [L]
RewriteRule ^.*\.jpg$ - [L]
RewriteRule ^.*\.png$ - [L]
RewriteRule ^.*\.gif$ - [L]
RewriteRule ^robots* - [L]
RewriteRule ^.*\.ico$ - [L]
RewriteRule ^.*\.txt$ - [L]
RewriteRule ^.*\.xml$ - [L]
RewriteRule ^.*\.php$ - [L]
RewriteRule ^/([^/]*)/([^/]*) /index.php?section=$1/$2 [PT]
RewriteRule ^/([^/]*) /index.php?section=$1 [PT]

Re: Apache HTTP mod_rewrite

am 11.04.2008 05:23:32 von Rz

On Apr 9, 11:23=A0pm, RZ wrote:
> Hey All,
>
> I am having issues with my regex in mod_rewrite.
>
> I am trying to change my web sites URL format from this:http://localhost/?=
section=3Dsitemap
> to this:http://localhost/sitemap
>
> The new format is working great at changing the new incoming URL
> format from thishttp://localhost/sitemapto my index.php.
>
> But I am having issues writing the old URL format (?section=3Dsitemap)
> to the new URL format (/sitemap).
>
> Can someone please help if you have time?
>
> Below are the regex's I am using right now at are working great.
>
> RewriteEngine On
> RewriteRule ^.*\.css$ - [L]
> RewriteRule ^.*\.jpg$ - [L]
> RewriteRule ^.*\.png$ - [L]
> RewriteRule ^.*\.gif$ - [L]
> RewriteRule ^robots* - [L]
> RewriteRule ^.*\.ico$ - [L]
> RewriteRule ^.*\.txt$ - [L]
> RewriteRule ^.*\.xml$ - [L]
> RewriteRule ^.*\.php$ - [L]
> RewriteRule ^/([^/]*)/([^/]*) /index.php?section=3D$1/$2 [PT]
> RewriteRule ^/([^/]*) /index.php?section=3D$1 [PT]

I got it working. Thank you.

RewriteEngine On
RewriteRule ^.*\.css$ - [L]
RewriteRule ^.*\.jpg$ - [L]
RewriteRule ^.*\.png$ - [L]
RewriteRule ^.*\.gif$ - [L]
RewriteRule ^robots* - [L]
RewriteRule ^.*\.ico$ - [L]
RewriteRule ^.*\.txt$ - [L]
RewriteRule ^.*\.xml$ - [L]
RewriteRule ^.*\.php$ - [L]
RewriteCond %{QUERY_STRING} section
RewriteRule .* - [L]
RewriteRule ^/([^/]*)(?:/|%2F)([^/]*) /index.php?section=3D$1/$2 [PT]
RewriteRule ^/([^/]*) /index.php?section=3D$1 [PT]