Forum Moderators: phranque
I googled 2 hours and read every post in that forum about mod_rewrite, tried all examples, but they didnīt work on my xp-apache-php-thing. so I reduced the commands to the lowest test-thing, found in that forum, too:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^index\.html$ index2.html [R=301,L]
I have a index.html and a index2.html in the directory of that .htaccess, but if I call index.html, nothings redirected :-(
I tried really everything and tried it on the webspace of my provider (linux), too!
what is the problem, or is there a test if mod_rewrite is deactivated? how to activate? Iīm getting crazy *baaaaaaaahhh*
thanks for help
[edited by: jdMorgan at 4:25 pm (utc) on Feb. 10, 2004]
[edit reason] speling [/edit]
Welcome to WebmasterWorld [webmasterworld.com]!
You'll need to make sure you've got mod_rewrite.c compiled-in and loaded, and that you have AllowOverride All, or at a minimum, AllowOverride FileInfo Options set - See the Apache core directives documentation for details.
Also, it may be that you have a settings problem on your own server, and a different problem such as "users not allowed to use mod_rewrite" on your host server.
Jim
I wanna do the often-complained dynamic-php to html-stuff.
my example:
[ibm...]
has to become search-engine-friendly and php has to work in the same way!
so I tried a lot, for example :
RewriteRule ^indexid([^.]+).*$ index.php?id=$1 [T=application/x-httpd-php]
or
RewriteRule ^index([^/]+)/([^/]+)$ dynamic/index.php?id=$1
but nothing happened. rewrite is activated, cause that example worked:
RewriteRule ^index1\.php$ index2.php
are in all that code-lines the condition-position wrong, isnīt it
RewriteRule SEARCHVALUE FINALVALUE
in all the examples found in net it is
RewriteRule FINALEVALUE SEARCHVALUE
can somebody help me, please no links to howtos or faqs, I red them all...
thanks!
What is the [^.] supposed to match?
A single dot will match any character.
A [***] will match any of the enclosed characters ***.
A [^***] will match any character *not* among those enclosed.
This means that [^.] will never match anything.
If your IDs are always numerical, then you probably want something like this:
RewriteRule ^indexid([0-9]+).*$ index.php?id=$1 [T=application/x-httpd-php,L] Note the L flag that I appended. This will prevent any other rewrite rules to kick in and alter the result again after this one succeeded.
Another special case to remember...
Jim