Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remote access of WAMP redirects to duplicate url

When I access WordPress website from remote device on local network ie: www.test.local WAMP decides to redirect this request to url which looks like www.test.localhttp/www.test.local/ And I will get an error. However when I access the url from the main computer(with WAMP) redirect does not occur. I tried to remove main wordpress htaccess. If the website has only index.html this problem does not occur.

All I get from error log:

[www.test.local/sid#1a426ce7a18][rid#1a432dc9390/initial] [perdir C:/Users/{MyUser}/work/test/www/] strip per-dir prefix: C:/Users/{MyUser}/work/test/www/ -> 
[www.test.local/sid#1a426ce7a18][rid#1a432dc9390/initial] [perdir C:/Users/{MyUser}/work/test/www/] applying pattern '^index\\.php$' to uri ''
[www.test.local/sid#1a426ce7a18][rid#1a432dc9390/initial] [perdir C:/Users/{MyUser}/work/test/www/] strip per-dir prefix: C:/Users/{MyUser}/work/test/www/ -> 
[www.test.local/sid#1a426ce7a18][rid#1a432dc9390/initial] [perdir C:/Users/{MyUser}/work/test/www/] applying pattern '.' to uri ''
[www.test.local/sid#1a426ce7a18][rid#1a432dc9390/initial] [perdir C:/Users/{MyUser}/work/test/www/] pass through C:/Users/{MyUser}/work/test/www/
[www.test.local/sid#1a426ce7a18][rid#1a4296ec5d0/subreq] [perdir C:/Users/{MyUser}/work/test/www/] strip per-dir prefix: C:/Users/{MyUser}/work/test/www/index.php -> index.php
[www.test.local/sid#1a426ce7a18][rid#1a4296ec5d0/subreq] [perdir C:/Users/{MyUser}/work/test/www/] applying pattern '^index\\.php$' to uri 'index.php'
[www.test.local/sid#1a426ce7a18][rid#1a4296ec5d0/subreq] [perdir C:/Users/{MyUser}/work/test/www/] pass through C:/Users/{MyUser}/work/test/www/index.php
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] add path info postfix: C:/Users/{MyUser}/work/test/www/www.test.local -> C:/Users/{MyUser}/work/test/www/www.test.local/
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] strip per-dir prefix: C:/Users/{MyUser}/work/test/www/www.test.local/ -> www.test.local/
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] applying pattern '^index\\.php$' to uri 'www.test.local/'
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] add path info postfix: C:/Users/{MyUser}/work/test/www/www.test.local -> C:/Users/{MyUser}/work/test/www/www.test.local/
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] strip per-dir prefix: C:/Users/{MyUser}/work/test/www/www.test.local/ -> www.test.local/
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] applying pattern '.' to uri 'www.test.local/'
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] RewriteCond: input='C:/Users/{MyUser}/work/test/www/www.test.local' pattern='!-f' => matched
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] RewriteCond: input='C:/Users/{MyUser}/work/test/www/www.test.local' pattern='!-d' => matched
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] rewrite 'www.test.local/' -> '/index.php'
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] trying to replace prefix C:/Users/{MyUser}/work/test/www/ with /
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] trying to replace context docroot c:/Users/{MyUser}/work/test/www with context prefix 
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334b9cc0/initial] [perdir C:/Users/{MyUser}/work/test/www/] internal redirect with /index.php [INTERNAL REDIRECT]
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334a4b68/initial/redir#1] [perdir C:/Users/{MyUser}/work/test/www/] strip per-dir prefix: C:/Users/{MyUser}/work/test/www/index.php -> index.php
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334a4b68/initial/redir#1] [perdir C:/Users/{MyUser}/work/test/www/] applying pattern '^index\\.php$' to uri 'index.php'
[www.test.localhttp/sid#1a426ce7a18][rid#1a4334a4b68/initial/redir#1] [perdir C:/Users/{MyUser}/work/test/www/] pass through C:/Users/{MyUser}/work/test/www/index.php
[www.test.localhttphttp/sid#1a426ce7a18][rid#1a4426f31f0/initial] [perdir C:/Users/{MyUser}/work/test/www/] add path info postfix: C:/Users/{MyUser}/work/test/www/www.test.localhttp -> C:/Users/{MyUser}/work/test/www/www.test.localhttp/www.test.local/
[www.test.localhttphttp/sid#1a426ce7a18][rid#1a4426f31f0/initial] [perdir C:/Users/{MyUser}/work/test/www/] strip per-dir prefix: C:/Users/{MyUser}/work/test/www/www.test.localhttp/www.test.local/ -> www.test.localhttp/www.test.local/

My vhosts file:

<VirtualHost *:80>
 ServerName localhost2.local
 ServerAlias *.*.local
 VirtualDocumentRoot "c:/Users/{MyUser}/work/%2/%1/"
 <Directory "c:/Users/{MyUser}/work/">
  ServerSignature Off
  Options Indexes FollowSymLinks IncludesNoExec
  AllowOverride All
  Order allow,deny
  Allow from all
  # Insert the following:
  Require all granted
 </Directory>
</VirtualHost>

If I will use standard WP generated .htaccess :

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

The results is that the URL is redirected to www.test.localhttphttphttp... etc until the limit is reached... On the remote device is WAMP pc IP as a proxy. Any idea where could the redirect be originating?

EDIT: Updated log - this is what shows rewrite tracing. When accessing from localhost machine it is the same up until the line 9 and then it just calls assets etc as usual...

like image 225
Jan Avatar asked Dec 31 '17 13:12

Jan


People also ask

How to remotely access Windows Wamp server?

Remotely accessing your Windows WAMP server sites over the internet. Step 1: setting permissions to allow other users to access your server. In WAMP server version 3.0.6 you'll need to modify the permissions that are ... Step 2: Allowing connections to your server through your firewall. Step 3: ...

How do I connect to Wamp from a different machine?

To connect to WAMP from a different machine, you must open port 80, 443 for remote access. Refer to the FAQ for Windows, Linux and macOS for more information. IMPORTANT: Bitnami Native Installers do not modify the firewall configuration of your computer, therefore the WAMP ports could be open which is a significant security risk.

Can I access the WAMP ports over a public IP address?

For security reasons, the WAMP ports in this solution cannot be accessed over a public IP address. To connect to WAMP from a different machine, you must open port 80, 443 for remote access. Refer to the FAQ for Windows, Linux and macOS for more information.

How do I change the Apache permissions in WAMP?

In WAMP server version 3.0.6 you'll need to modify the permissions that are found within Apache's https-vhosts.conf file which can be found by clicking the WAMP icon in task bar and hovering over the "Apache" dropdown.


1 Answers

EDIT: This doesn't seem to be the problem, as the updates to the question make clear. Still leaving this here for random googlers that may find it useful.

To update your wordpress site's URL:

You can update the option_name's 'home' and 'siteurl' to option_value's of 'http://www.test.local/' (same value for both) in your wp_options table -

     UPDATE [yourWPDB].wp_options
     SET option_value='http://www.test.local/'
     WHERE option_name = 'home' OR option_name = 'siteurl'

You can also add the following lines to your wp-config.php file in your wordpress root to update -

     define('WP_SITEURL', 'http://www.test.local/');
     define('WP_HOME', 'http://www.test.local/');
like image 132
TCooper Avatar answered Nov 03 '22 17:11

TCooper