We have a rewrite rule that works fine, but the reason why we're rewriting is because the target URL is not so tidy.
foo.com/bar -> foo.com/some/really/long/address
What I would like to do is keep the foo.com/bar URL in the browser, but show the foo.com/some/really/long/address page. Is this possible?
From serverfault
nbolton
-
mod_rewrite it what you need.
This is quite easy and its a powerfull tool.
I suggest to read this -> http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
And example :
this estarts de rewriteengine, then applies some conditions and if they are true then applies the rewrite itself. its like a while/case codeblock.
The most helpful part is the log .;)
RewriteEngine on RewriteLogLevel 0 RewriteLog "/var/www/rewrite.log" <Directory /var/www> Options -ExecCGI -Indexes AllowOverride none Order allow,deny allow from all #SetHandler none RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} -d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^(\w+.\w+)/(es|ca|en)/$ index.php?user=$1&lang=$2 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} -d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^(\w+.\w+)/$ index.php?user=$1&lang= [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^(\w+.\w+)/(\w+)?(/(.*))?$ index.php?user=$1&lang=$2$4 [L,QSA]also, you can look at mod_proxy, it will do the trick but it's not the 'good way' in my opinion.
hope it helps.
From marc.riera
0 comments:
Post a Comment