how can i redirect all requests coming on
foo.bar.com/some-thing
to be redirected to
foo.bar.com/some-thing-else
also can you please hook me up to some good learning resources for learning htaccess, i开发者_如何学Python am very new to this development stuff.
Regards.
Edit following is the code i have been trying with (without success)
RewriteRule ^some-thing?$ index.php/some-thing-else [QSA,L]
try something like this : in the .htaccess put this :
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule ^(.*)-thing?$ index.php?route=$1-thing-else [QSA,L]
in the index php put this for testing :
<?php echo var_dump( $_GET ); ?>
browse to your site ie http://localhost/some-thing
or http://localhost/dirty-thing
.
hope you can modify this to your exact needs.
It is mod_rewrite
Apache module what you should be working with to do such redirects. It's not simple to learn, still very powerful tool. There are multiple tutorials learning it. Try http://www.easymodrewrite.com/ for beginning.
精彩评论