homepage Welcome to WebmasterWorld Guest from 54.146.175.204
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Redirect to localhost in .htaccess
kambiz marta



 
Msg#: 4554260 posted 11:04 am on Mar 13, 2013 (gmt 0)

Hi,
I have to do some changes in a web that is not written for me.
For this reason I've downloaded it and I want to test it in my computer.
I have to changes something to redirect some webs to localhost instead of server. But I can't do it.
I'll be very grateful if somebody can help me.

This is the code, I've commented the line thats works on the server, and below I've changed it, but it doesn't work. Thanks

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]

 

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4554260 posted 11:14 am on Mar 13, 2013 (gmt 0)

The fault report "doesn't work" is completely useless to describe what you expected, what actually happened, and how that differed from what you wanted.


Delete line 3 and line 5.

When on live site activate line 2 and line 4.
When on localhost comment out line 2 and line 4.


The (.*)_(.*) part of the patterns should be ([^_]+)_([^.]+) or similar.

kambiz marta



 
Msg#: 4554260 posted 12:21 pm on Mar 13, 2013 (gmt 0)

Sorry, you are right, the url it seems to be correct:
http://localhost:8887/camps/pisos-casas


In the server the url is:
http://www.example.com/pisos-casas


And the error is 404 that appears when I execute in localhost.

Thanks for your answer

[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]

kambiz marta



 
Msg#: 4554260 posted 12:23 pm on Mar 13, 2013 (gmt 0)

Sorry, but I can't understand what do you mean with

The (.*)_(.*) part of the patterns should be ([^_]+)_([^.]+) or similar.

Thanks

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4554260 posted 1:13 pm on Mar 13, 2013 (gmt 0)

welcome to WebmasterWorld, kambiz marta!

check your server access and error logs for clues about what caused that 404.


Sorry, but I can't understand what do you mean with The (.*)_(.*) part of the patterns should be ([^_]+)_([^.]+) or similar.

the .* pattern is "promiscuous, ambiguous and greedy" so g1smd is suggesting a more specific/efficient regular expression.

kambiz marta



 
Msg#: 4554260 posted 1:54 pm on Mar 13, 2013 (gmt 0)

Sorry if I've said something wrong, I'm not used to write in english

kambiz marta



 
Msg#: 4554260 posted 1:55 pm on Mar 13, 2013 (gmt 0)

The code I've posted is just a copy and paste of the file in the server.

kambiz marta



 
Msg#: 4554260 posted 2:07 pm on Mar 13, 2013 (gmt 0)

Hi,
I've restarted the service, and the Apache error.log says:

[Wed Mar 13 15:02:18.650232 2013] [mpm_winnt:notice] [pid 12296:tid 296] AH00424: Parent: Received restart signal -- Restarting the server.
[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
[Wed Mar 13 15:02:18.756303 2013] [mpm_winnt:notice] [pid 12296:tid 296] AH00456: Server built: Apr 20 2012 19:24:55
[Wed Mar 13 15:02:18.756303 2013] [core:notice] [pid 12296:tid 296] AH00094: Command line: 'C:\\PROGRA~2\\EASYPH~1.1\\Apache\\bin\\apache.exe -d C:/Program Files (x86)/EasyPHP-12.1/apache'
[Wed Mar 13 15:02:18.756303 2013] [mpm_winnt:notice] [pid 12296:tid 296] AH00418: Parent: Created child process 6532
[Wed Mar 13 15:02:19.651898 2013] [mpm_winnt:notice] [pid 6532:tid 536] AH00354: Child: Starting 64 worker threads.
[Wed Mar 13 15:02:20.652566 2013] [mpm_winnt:notice] [pid 6624:tid 532] AH00364: Child: All worker threads have exited.

And the Apache access.log says:
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
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

For me any clue.

Thanks

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4554260 posted 8:25 pm on Mar 13, 2013 (gmt 0)

I have to changes something to redirect some webs to localhost instead of server.

Does "localhost" mean simply your own computer, or does it mean a pseudo-server such as WAMP? If WAMP (or MAMP or similar), do you have the basic version that only does one domain at a time, or the fancy version that comes with a fake DNS?

If a link includes the complete domain name, there is no way to intercept that. You can only intercept incoming links. UNLESS your setup includes the pseudo-DNS aspect.

Lines like this
127.0.0.1 - - [13/Mar/2013:15:02:26 +0100] "GET /fincamps/pisos-casas HTTP/1.1" 404 1279
together with your first post make it sound as if the real site does some rewriting. You need to have the identical rewrites in place on your offline test site.

127.0.0.1 - - [13/Mar/2013:15:02:26 +0100] "GET /favicon.ico HTTP/1.1" 404 1129
Well, that one's easy ;) Your browser is asking for the favicon-- as browsers always do-- and you probably didn't bother to put a copy on your offline site. May as well include one, just so the browser can stop asking for it. Otherwise it will make a fresh request on every single page load.

This
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

is an absolutely horrendous pattern. Is this the kind of thing you were called in to fix?

/fincamps 301 to /fincamps/ is legitimate IF the original request was a type-in AND "fincamps" is a real, physical directory. If both of those things are true, it is simply mod_dir doing its job. BUT if either of those things is not true, there is a problem.

/fincamps/ 302 to /fincamps/es followed by 301 to /fincamps/es/ cannot possibly be right. The first redirect is presumably triggered by something in the code that either detects system language or reads a cookie. But it should go straight to /es/ whether or not that is a real, physical directory.

kambiz marta



 
Msg#: 4554260 posted 10:00 pm on Mar 13, 2013 (gmt 0)

Thanks for your answer.
Localhost means my computer: 127.0.0.1 I've installed EasyPHP 5.4.6, Apache 2.4.2

Lines like this
127.0.0.1 - - [13/Mar/2013:15:02:26 +0100] "GET /fincamps/pisos-casas HTTP/1.1" 404 1279
together with your first post make it sound as if the real site does some rewriting. You need to have the identical rewrites in place on your offline test site.

I've got it identical
fincamps/pisos-casas is the page sabadell/index.php with parameters, which is redirected in htaccess. It works in the server, but not in localhost

/fincamps 301 to /fincamps/ is legitimate IF the original request was a type-in AND "fincamps" is a real, physical directory. If both of those things are true, it is simply mod_dir doing its job. BUT if either of those things is not true, there is a problem. fincamps is physical directory

127.0.0.1 - - [13/Mar/2013:15:02:26 +0100] "GET /favicon.ico HTTP/1.1" 404 1129
Well, that one's easy ;) Your browser is asking for the favicon-- as browsers always do-- and you probably didn't bother to put a copy on your offline site. May as well include one, just so the browser can stop asking for it. Otherwise it will make a fresh request on every single page load.
favicon.ico is in the root directory, I don't know why is asking for it. I've got exactly same files, same folders like in the server

is an absolutely horrendous pattern. Is this the kind of thing you were called in to fix?I don't understand what do you mean

/fincamps/ 302 to /fincamps/es followed by 301 to /fincamps/es/ cannot possibly be right. The first redirect is presumably triggered by something in the code that either detects system language or reads a cookie. But it should go straight to /es/ whether or not that is a real, physical directory. Sure you are right, but this is what access.log contains.

Thanks very much for your help

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4554260 posted 11:10 pm on Mar 13, 2013 (gmt 0)

Oops. When I said "can't be right" I didn't mean that your logs are in error. I meant that the redirect pattern can't be intentional. This may be the easiest issue to fix, so why not look into it first.

It works in the server, but not in localhost

Same version of apache on both? Same config file settings? Do other redirects and rewrites work as intended?

kambiz marta



 
Msg#: 4554260 posted 7:11 am on Mar 14, 2013 (gmt 0)

Oh my God! How difficult is a thing when you don't know how to do it! After work I'll continue with it.
Thanks very much.

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4554260 posted 8:09 am on Mar 14, 2013 (gmt 0)

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

how did the request for /camps/pisos-casas become a request to /fincamps/pisos-casas?


rewritecond %{http_host} ^localhost$ [nc]
rewriterule ^(.*)$ /$1 [r=301,nc]

what are you trying to accomplish here?


rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc]

not related to your current problem but the directives above should be changed to something more like this:
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

as suggested by lucy24, your language detection should do that 302 redirect to the language subdirectory /fincamps/es/ and not to a url that is missing the trailing slash.


I've got it identical fincamps/pisos-casas is the page sabadell/index.php with parameters, which is redirected in htaccess.

these rewrites won't match the pattern unless they are in the /fincamps/.htaccess file:
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

where is the error log entry showing the missing file?


there's still some missing information.
does your example.com server have .htaccess files in any subdirectories?

perhaps you should temporarily enable rewrite logging on your localhost server so you can see what's happening.
mod_rewrite logging:
http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#logging

kambiz marta



 
Msg#: 4554260 posted 2:26 pm on Mar 14, 2013 (gmt 0)

Hi, thanks very much for your long answer. Now I have to understand it, for this I'll need little time because I know very little english.

For the moment I say this:

how did the request for /camps/pisos-casas become a request to /fincamps/pisos-casas? It's a mistake, fincamps is nothing, all should be camps


what are you trying to accomplish here?
rewritecond %{http_host} ^localhost$ [nc]
rewriterule ^(.*)$ /$1 [r=301,nc]
Well, my idea is to execute this web in my computer. So I thought if I change this lines, instead of redirect to the server, redirect them to my localhost, for this reason I replaced
#rewritecond %{http_host} ^camps.es [nc] for this
rewritecond %{http_host} ^localhost:8887$ [nc]

and
#rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc] for this
rewriterule ^(.*)$ localhost:8887?/$1 [r=301,nc]


as suggested by lucy24, your language detection should do that 302 redirect to the language subdirectory /camps/es/ and not to a url that is missing the trailing slash.
127.0.0.1 - - [13/Mar/2013:15:02:22 +0100] "GET /camps/ HTTP/1.1" 302 664
The reason of this is because I was testing and changing the rules occurred this error

these rewrites won't match the pattern unless they are in the /fincamps/.htaccess file:
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
These rewrites are in camps/.htaccess. Like in the server

does your example.com server have .htaccess files in any subdirectories?
Ops! I thought only htaccess file would be. I've searched remotes .htaccess and yes, I've found 5 more, saved in the language folders. The content of them is:
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteBase /es/

RewriteRule ^(.*)_(.*)_(.*)_(.*)\.html$ /es/operacion.php?idn=$1&pag=$2&s=$3&f=$4 [L] #familia menu nivel 2

RewriteRule ^(.*)_(.*)_(.*)-(.*)\.html$ /es/operacion.php?idn=$1&pag=$2&s=$3&t=$4 [L] #tipo familia menu nivel 3

RewriteRule ^(.*)\.html$ /es/detalle.php?id=$1 [L] # pagina detalle

Until night I can't do anything more. I must go to work.
Thanks very much for your help.

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4554260 posted 9:26 pm on Mar 14, 2013 (gmt 0)

Options +SymLinksIfOwnerMatch
RewriteEngine On

Aaaaaaack!

:: runs around screaming in horror ::

Isn't there a Universal Rule that says if you meet something new in one place, you will promptly meet the same something new in three other places?

UNLESS those supplementary htaccess files also contain the line
RewriteOptions inherit
(can go either before or after "RewriteEngine on")
they will make it as if the top htaccess file doesn't exist for the affected directories. This applies only to mod_rewrite. Other things like access control or indexing are not affected.

kambiz marta



 
Msg#: 4554260 posted 8:05 am on Mar 15, 2013 (gmt 0)

Good morning and thanks again. I'm sad thinking I'll never be able to install this web in my computer. Why things are so difficult?

Options +SymLinksIfOwnerMatch
RewriteEngine On
:: runs around screaming in horror ::

I understand you don't like this, but you suggest to add RewriteOptions inherit to solve if the directories doesn't exist, isn't it?
I've added this line, before, after, and nothing, same error 404

Thanks for your patience.

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4554260 posted 9:43 am on Mar 15, 2013 (gmt 0)

what does the rewrite log show?

kambiz marta



 
Msg#: 4554260 posted 10:25 am on Mar 15, 2013 (gmt 0)

Hi again and thanks for your answer.
I don't know exactly which is the rewrite log, for this I'm going to copy here 2 logs, waiting one of this will be.

Apache error - error.log
[Fri Mar 15 11:08:08.582031 2013] [mpm_winnt:notice] [pid 4404:tid 636] AH00455: Apache/2.4.2 (Win32) PHP/5.4.6 configured -- resuming normal operations
[Fri Mar 15 11:08:08.582031 2013] [mpm_winnt:notice] [pid 4404:tid 636] AH00456: Server built: Apr 20 2012 19:24:55
[Fri Mar 15 11:08:08.582031 2013] [core:notice] [pid 4404:tid 636] AH00094: Command line: 'C:\\PROGRA~2\\EASYPH~1.1\\Apache\\bin\\apache.exe -d C:/Program Files (x86)/EasyPHP-12.1/apache'
[Fri Mar 15 11:08:08.583032 2013] [mpm_winnt:notice] [pid 4404:tid 636] AH00418: Parent: Created child process 6240
[Fri Mar 15 11:08:09.274494 2013] [mpm_winnt:notice] [pid 6240:tid 636] AH00354: Child: Starting 64 worker threads.
[Fri Mar 15 11:18:00.813180 2013] [core:warn] [pid 3716:tid 356] AH00098: pid file C:/Program Files (x86)/EasyPHP-12.1/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Mar 15 11:18:13.969825 2013] [mpm_winnt:notice] [pid 3716:tid 356] AH00455: Apache/2.4.2 (Win32) PHP/5.4.6 configured -- resuming normal operations
[Fri Mar 15 11:18:13.980683 2013] [mpm_winnt:notice] [pid 3716:tid 356] AH00456: Server built: Apr 20 2012 19:24:55
[Fri Mar 15 11:18:13.980683 2013] [core:notice] [pid 3716:tid 356] AH00094: Command line: 'C:\\PROGRA~2\\EASYPH~1.1\\Apache\\bin\\apache.exe -d C:/Program Files (x86)/EasyPHP-12.1/apache'
[Fri Mar 15 11:18:14.031163 2013] [mpm_winnt:notice] [pid 3716:tid 356] AH00418: Parent: Created child process 3924
[Fri Mar 15 11:18:15.139555 2013] [mpm_winnt:notice] [pid 3924:tid 588] AH00354: Child: Starting 64 worker threads.
[Fri Mar 15 11:23:08.762273 2013] [core:warn] [pid 6936:tid 288] AH00098: pid file C:/Program Files (x86)/EasyPHP-12.1/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Mar 15 11:23:08.797301 2013] [mpm_winnt:notice] [pid 6936:tid 288] AH00455: Apache/2.4.2 (Win32) PHP/5.4.6 configured -- resuming normal operations
[Fri Mar 15 11:23:08.797301 2013] [mpm_winnt:notice] [pid 6936:tid 288] AH00456: Server built: Apr 20 2012 19:24:55
[Fri Mar 15 11:23:08.797301 2013] [core:notice] [pid 6936:tid 288] AH00094: Command line: 'C:\\PROGRA~2\\EASYPH~1.1\\Apache\\bin\\apache.exe -d C:/Program Files (x86)/EasyPHP-12.1/apache'
[Fri Mar 15 11:23:08.798297 2013] [mpm_winnt:notice] [pid 6936:tid 288] AH00418: Parent: Created child process 2124
[Fri Mar 15 11:23:09.088492 2013] [mpm_winnt:notice] [pid 2124:tid 540] AH00354: Child: Starting 64 worker threads.

Apache access - access.log
127.0.0.1 - - [15/Mar/2013:11:08:17 +0100] "GET / HTTP/1.1" 200 3366
127.0.0.1 - - [15/Mar/2013:11:08:18 +0100] "GET /images_easyphp/top_background.gif HTTP/1.1" 200 60
127.0.0.1 - - [15/Mar/2013:11:08:18 +0100] "GET /images_easyphp/top_section_in.gif HTTP/1.1" 200 55
127.0.0.1 - - [15/Mar/2013:11:08:18 +0100] "GET /images_easyphp/top_version.gif HTTP/1.1" 200 252
127.0.0.1 - - [15/Mar/2013:11:08:18 +0100] "GET /images_easyphp/admin.gif HTTP/1.1" 200 64
127.0.0.1 - - [15/Mar/2013:11:08:18 +0100] "GET /images_easyphp/top_section_out.gif HTTP/1.1" 200 56
127.0.0.1 - - [15/Mar/2013:11:08:18 +0100] "GET /images_easyphp/top_title.gif HTTP/1.1" 200 705
127.0.0.1 - - [15/Mar/2013:11:08:19 +0100] "GET /icons/blank.gif HTTP/1.1" 200 148
127.0.0.1 - - [15/Mar/2013:11:08:19 +0100] "GET /icons/folder.gif HTTP/1.1" 200 225
127.0.0.1 - - [15/Mar/2013:11:08:19 +0100] "GET /favicon.ico HTTP/1.1" 404 1129
127.0.0.1 - - [15/Mar/2013:11:08:22 +0100] "GET /fincamps/ HTTP/1.1" 302 664
127.0.0.1 - - [15/Mar/2013:11:08:23 +0100] "GET /fincamps/es HTTP/1.1" 301 242
127.0.0.1 - - [15/Mar/2013:11:08:23 +0100] "GET /fincamps/es/ HTTP/1.1" 200 18737
127.0.0.1 - - [15/Mar/2013:11:08:24 +0100] "GET /fincamps/css/style_home.css HTTP/1.1" 200 5141
127.0.0.1 - - [15/Mar/2013:11:08:24 +0100] "GET /fincamps/css/css.css HTTP/1.1" 200 27663
127.0.0.1 - - [15/Mar/2013:11:08:24 +0100] "GET /fincamps/js/changevideo.js HTTP/1.1" 200 750
127.0.0.1 - - [15/Mar/2013:11:08:24 +0100] "GET /fincamps/js/jquery.cookie.js HTTP/1.1" 200 4467
127.0.0.1 - - [15/Mar/2013:11:08:24 +0100] "GET /fincamps/js/jquery-1.3.2.min.js HTTP/1.1" 200 57272
127.0.0.1 - - [15/Mar/2013:11:08:25 +0100] "GET /fincamps/jquery.fancybox/jquery.fancybox.css HTTP/1.1" 200 5146
127.0.0.1 - - [15/Mar/2013:11:08:25 +0100] "GET /fincamps/jquery.fancybox/jquery.easing.1.3.js HTTP/1.1" 200 8301
127.0.0.1 - - [15/Mar/2013:11:08:25 +0100] "GET /fincamps/jquery.fancybox/jquery.fancybox-1.2.1.pack.js HTTP/1.1" 200 8312
127.0.0.1 - - [15/Mar/2013:11:08:25 +0100] "GET /fincamps/image/bg_header.jpg HTTP/1.1" 200 11082
127.0.0.1 - - [15/Mar/2013:11:08:25 +0100] "GET /fincamps/image/telefono.jpg HTTP/1.1" 200 3752
127.0.0.1 - - [15/Mar/2013:11:08:25 +0100] "GET /fincamps/image/logo_fincamps.jpg HTTP/1.1" 200 20518
127.0.0.1 - - [15/Mar/2013:11:08:25 +0100] "GET /fincamps/img/bot_menu_roll.png HTTP/1.1" 200 3976
127.0.0.1 - - [15/Mar/2013:11:08:25 +0100] "GET /fincamps/img/tab.gif HTTP/1.1" 200 2039
127.0.0.1 - - [15/Mar/2013:11:08:26 +0100] "GET /fincamps/img/solares-parcelas.jpg HTTP/1.1" 200 25338
127.0.0.1 - - [15/Mar/2013:11:08:25 +0100] "GET /fincamps/img/pisos-casas.jpg HTTP/1.1" 200 23101
127.0.0.1 - - [15/Mar/2013:11:08:26 +0100] "GET /fincamps/img/naves-industriales.jpg HTTP/1.1" 200 22490
127.0.0.1 - - [15/Mar/2013:11:08:26 +0100] "GET /fincamps/img/locales-oficinas.jpg HTTP/1.1" 200 19772
127.0.0.1 - - [15/Mar/2013:11:08:26 +0100] "GET /fincamps/img/parkings.jpg HTTP/1.1" 200 21127
127.0.0.1 - - [15/Mar/2013:11:08:26 +0100] "GET /fincamps/img/immuebles-singulares.jpg HTTP/1.1" 200 20997
127.0.0.1 - - [15/Mar/2013:11:08:26 +0100] "GET /fincamps/img/line.jpg HTTP/1.1" 200 13860
127.0.0.1 - - [15/Mar/2013:11:08:26 +0100] "GET /fincamps/img/banner_bg.jpg HTTP/1.1" 200 11272
127.0.0.1 - - [15/Mar/2013:11:08:26 +0100] "GET /fincamps/img/oportunidades.jpg HTTP/1.1" 200 23356
127.0.0.1 - - [15/Mar/2013:11:08:26 +0100] "GET /fincamps/img/banner1.jpg HTTP/1.1" 200 22312
127.0.0.1 - - [15/Mar/2013:11:08:26 +0100] "GET /fincamps/img/promociones.jpg HTTP/1.1" 200 36390
127.0.0.1 - - [15/Mar/2013:11:08:26 +0100] "GET /fincamps/img/banner3.jpg HTTP/1.1" 200 19440
127.0.0.1 - - [15/Mar/2013:11:08:26 +0100] "GET /fincamps/img/banner2.jpg HTTP/1.1" 200 22307
127.0.0.1 - - [15/Mar/2013:11:08:26 +0100] "GET /fincamps/img/api.jpg HTTP/1.1" 200 19181
127.0.0.1 - - [15/Mar/2013:11:08:26 +0100] "GET /fincamps/img/administradores.jpg HTTP/1.1" 200 16904
127.0.0.1 - - [15/Mar/2013:11:08:27 +0100] "GET /fincamps/favicon.ico HTTP/1.1" 200 3638
127.0.0.1 - - [15/Mar/2013:11:08:30 +0100] "GET /fincamps/pisos-casas HTTP/1.1" 404 1279
127.0.0.1 - - [15/Mar/2013:11:08:30 +0100] "GET /favicon.ico HTTP/1.1" 404 1129


Thanks very much

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4554260 posted 10:31 am on Mar 15, 2013 (gmt 0)

what trace level are you using for rewrite logging?

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4554260 posted 10:59 am on Mar 15, 2013 (gmt 0)

(.*)_(.*)_(.*)-(.*)
Now, you know g1smd is not going to let you get away with that.

Remember that mod_rewrite and htaccess and Apache and all computers everywhere are very stupid. They can only think in one dimension. They can't say "I must leave room for a lowline and other stuff and another lowline and more stuff and a hyphen and..." It is all "Oh, oops, I gobbled up the whole thing and now I must spit it out and find a lowline." Unless you tell it not to be so greedy in the first place.

So what you need is probably something like

([^_]+)_([^_]+)_([^-]+)-(.+)

Never .* except maybe at the very end. Otherwise you could have an URL like

([^_]*)_([^_]*)_([^-]*)-(.+)
=
()_()_()-()
=
www.example.com/__-

I am sure you do not have anything like that. So you do not need to write code for it.

All those extra htaccess files may or may not have anything to do with your problem. It depends on where they are located, and what files are in those directories.

Oh and Psst! If you don't want to use the formatting buttons,* you can also type it out like
[quote]blahblah[/quote]
=
blahblah



* Or if you clicked Quick Reply so you don't see the buttons yet.

kambiz marta



 
Msg#: 4554260 posted 3:57 pm on Mar 15, 2013 (gmt 0)

Thanks everybody for your help. I think I'm going to abandone update this web.
It's more than 15 days I try to execute this web downloaded from the server and I can't understand why is so difficult to do it.
I supose I'm not prepared for it.
Again, thanks very much for all

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4554260 posted 9:32 pm on Mar 15, 2013 (gmt 0)

mod_rewrite logging:
http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#logging

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4554260 posted 12:17 am on Mar 16, 2013 (gmt 0)

Or:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritelog

As I suspected, this cannot be set in htaccess. (Same goes for error logs and presumably all other logs.)

kambiz marta



 
Msg#: 4554260 posted 8:48 am on Mar 16, 2013 (gmt 0)

Thanks again, but your knowledge about this topic is very hight for me and some times I don't understand you.
I'm going to read some tutorials about htaccess if I'm able to really understand it. If I can and I solve my problem I'll will inform you

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4554260 posted 9:53 am on Mar 16, 2013 (gmt 0)

[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


@2.4 RewriteLog was "completely replaced by the new per-module logging configuration"

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4554260 posted 10:44 am on Mar 16, 2013 (gmt 0)

Ah, the proverbial fine print. I would never have seen that. PHP 5.4 too. I'm envious.

In 2.4 you can set log levels separately by directory, but it still can't be set in htaccess. And somewhere in this thread there was mention of five assorted htaccess files, which is five more than you'd have if it was your server in real life :(

Now, if you really do control the whole server, then you should absolutely get rid of all those additional htaccess files. It all goes in <Directory> sections inside the config file.

ZydoSEO

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4554260 posted 7:17 pm on Mar 21, 2013 (gmt 0)

Hmmm Maybe I'm misreading your original question...

Did you copy someone else's website code to your local machine and now you're wanting their site to run locally?

If so then why not simply change your local HOSTS file so that ALL local page requests from your machine containing hostnames example.com and www.example.com automatically go to localhost (your local web server). Something like:

127.0.0.1 www.example.com
127.0.0.1 example.com

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4554260 posted 10:01 pm on Mar 21, 2013 (gmt 0)

Oh, and by the way...

%{http_host} ^localhost$ [nc]

Setting aside the [NC] --which doesn't belong in this rule-- is that really your full hostname? On my setup there's a port number, so the full hostname is

localhost:8888

I think that's standard for MAMP/WAMP. Did you ever say what you're using for your local hosting?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved