Tuesday, January 9, 2018

Remote access of WAMP redirects to duplicate url

Leave a Comment

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...

3 Answers

Answers 1

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/'); 

Answers 2

You have to update your site url and domain name on the wordpress configuration. This is saved as a serialized data in a table that I do not remember the name.

The easiest fix is edit index.php and at the end add:

update_option( 'siteurl', 'http://www.test.local' ); update_option( 'home', 'http://www.test.local' ); 

Open your site this will update your wordpress configuration. Then you can delete those lines and leave the index.php as it was.

Clear your browser cache or use the incognito mode and open www.test.local

Answers 3

try updating options values 'siteurl'=>'http://www.test.local' ); 'home'=>'http://www.test.local' from database (wp_options) table and dont put trailing slash at the end of the url.. e.g. www.test.local/..reset permalink from backend as well

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment