Forum Moderators: phranque
RewriteEngine On
#rewritecond %{http_host} ^example.com [nc]
rewritecond %{http_host} ^localhost$ [nc]
#rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc]
rewriterule ^(.*)$ /$1 [r=301,nc]
RewriteRule ^(pisos-casas|locales-oficinas|solares-parcelas|naves-industriales|parkings|inmuebles-singulares)/(.[a-zA-Z0-9_\-]{1,50})-(.*)_(.*)\.html$ /sabadell/index.php?cat=$1&lng=es&op=$2&od=$3&pg=$4 [L] #OPERACIONES
RewriteRule ^(pisos-cases|locals-oficines|solars-parceles|naus-industrials|parquings|immobles-singulars)/(.[a-zA-Z0-9_\-]{1,50})-(.*)_(.*)\.html$ /sabadell/index.php?cat=$1&lng=ca&op=$2&od=$3&pg=$4 [L] #OPERACIONES
[edited by: incrediBILL at 7:40 pm (utc) on Mar 13, 2013]
[edit reason] URL removed, use Example.com, see forum charter and site TOS [/edit]
http://localhost:8887/camps/pisos-casas
http://www.example.com/pisos-casas
[edited by: incrediBILL at 7:41 pm (utc) on Mar 13, 2013]
[edit reason] URL removed, use Example.com, see forum charter and site TOS [/edit]
Sorry, but I can't understand what do you mean with The (.*)_(.*) part of the patterns should be ([^_]+)_([^.]+) or similar.
I have to changes something to redirect some webs to localhost instead of server.
127.0.0.1 - - [13/Mar/2013:15:02:26 +0100] "GET /fincamps/pisos-casas HTTP/1.1" 404 1279 127.0.0.1 - - [13/Mar/2013:15:02:26 +0100] "GET /favicon.ico HTTP/1.1" 404 1129 127.0.0.1 - - [13/Mar/2013:15:02:22 +0100] "GET /fincamps HTTP/1.1" 301 239
127.0.0.1 - - [13/Mar/2013:15:02:22 +0100] "GET /fincamps/ HTTP/1.1" 302 664
127.0.0.1 - - [13/Mar/2013:15:02:22 +0100] "GET /fincamps/es HTTP/1.1" 301 242
127.0.0.1 - - [13/Mar/2013:15:02:22 +0100] "GET /fincamps/es/ HTTP/1.1" 200 18737 It works in the server, but not in localhost
Sorry, you are right, the url it seems to be correct:http://localhost:8887/camps/pisos-casas
127.0.0.1 - - [13/Mar/2013:15:02:26 +0100] "GET /fincamps/pisos-casas HTTP/1.1" 404 1279
rewritecond %{http_host} ^localhost$ [nc]
rewriterule ^(.*)$ /$1 [r=301,nc]
rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
127.0.0.1 - - [13/Mar/2013:15:02:22 +0100] "GET /fincamps/ HTTP/1.1" 302 664
127.0.0.1 - - [13/Mar/2013:15:02:22 +0100] "GET /fincamps/es HTTP/1.1" 301 242
127.0.0.1 - - [13/Mar/2013:15:02:22 +0100] "GET /fincamps/es/ HTTP/1.1" 200 18737
I've got it identical fincamps/pisos-casas is the page sabadell/index.php with parameters, which is redirected in htaccess.
RewriteRule ^(pisos-casas|locales-oficinas|solares-parcelas|naves-industriales|parkings|inmuebles-singulares)/(.[a-zA-Z0-9_\-]{1,50})-(.*)_(.*)\.html$ /sabadell/index.php?cat=$1&lng=es&op=$2&od=$3&pg=$4 [L] #OPERACIONES RewriteRule ^(pisos-cases|locals-oficines|solars-parceles|naus-industrials|parquings|immobles-singulars)/(.[a-zA-Z0-9_\-]{1,50})-(.*)_(.*)\.html$ /sabadell/index.php?cat=$1&lng=ca&op=$2&od=$3&pg=$4 [L] #OPERACIONES
127.0.0.1 - - [13/Mar/2013:15:02:26 +0100] "GET /fincamps/pisos-casas HTTP/1.1" 404 1279
127.0.0.1 - - [13/Mar/2013:15:02:26 +0100] "GET /favicon.ico HTTP/1.1" 404 1129
Options +SymLinksIfOwnerMatch
RewriteEngine On RewriteOptions inherit (.*)_(.*)_(.*)-(.*) ([^_]+)_([^_]+)_([^-]+)-(.+) [quote]blahblah[/quote] blahblah
[Wed Mar 13 15:02:18.756303 2013] [mpm_winnt:notice] [pid 12296:tid 296] AH00455: Apache/2.4.2 (Win32) PHP/5.4.6 configured -- resuming normal operations
Or:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritelog
%{http_host} ^localhost$ [nc]