RewriteCond and Rule

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

I've been trying to make my urls look like site.com/foo instead of site.com/index.php?page=foo so I have one rewriterurl that rewrites /foo to my php script and one rule that redirects old index.php-url:s to my new urls. When I apply both rules they end up in an infinite loop that I just can't get to stop. I've tried adding a lot of different conds, but I can't get it to work.

# If the url does not contain index.php rewrite to index.php script
RewriteCond %{REQUEST_URI} !index\.php
RewriteRule ^([a-z_]*)$ index.php?page=$1 [L]


# If the url does contain index.php redirect to /foo
RewriteCond %{REQUEST_URI} index\.php
RewriteCond %{QUERY_STRING} page=([a-z_]*)
RewriteRule ^index.php$ /base/path/%1? [R=301,L]

Any ideas?

--

Hälsningar Emil Edeholt

Karlsson & Novak Medical AB
Telefon 090-154830
Mobil 070-3758222
E-post emil@xxxxxxxxxxxx


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux