Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: .htaccess problem - localhost/sitename/ duplicated in links |
|
Author |
|
TRolandB
Joined: 04 Dec 2011 Posts: 2 Location: London, UK
|
Posted: Sun 04 Dec '11 0:04 Post subject: .htaccess problem - localhost/sitename/ duplicated in links |
|
|
I migrated a wordpress site to xampp using the same steps I have successfully used on two other sites:
1) Changed the site url option in the database to http://localhost/sitename.com/
2) Changed permalinks structure to default
But when links on the local site were clicked parts of the urls were duplicated. For example this link (as it is in source view for the index page, with sitename.com replacing my site's name):
http://localhost/sitename.com/?page_id=129
when clicked, took me to:
http://localhost/sitename.com/localhost/sitename.com/?page_id=129
Which just returned me to the xampp landing page. My .htaccess file looked like this:
Code: | # 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 |
Any ideas as to what was causing this and how I can fix it? I have applied a fix by changing the second RewriteRule line in .htaccess to:
Code: | RewriteRule . /sitename.com/index.php [L] |
Now the links do work, although the address is now:
http://localhost/sitename.com/localhost/sitename.com/localhost/sitename.com/localhost/sitename.com/localhost/sitename.com/?page_id=129
Even stranger! So while it seems to be working the url generated above is obviously not ideal. Disabling mod_rewrite stops the links working at all, and getting rid of the first RewriteRule line cuts down the number of duplications to 2, and the links still work. However I don't have much understanding of the htaccess file, I'm just trying things at random.
All help appreciated. Thanks,
Will |
|
Back to top |
|
TRolandB
Joined: 04 Dec 2011 Posts: 2 Location: London, UK
|
Posted: Sun 04 Dec '11 3:39 Post subject: Problem Solved |
|
|
Problem solved on another forum. Changing 'site address' in wordpress admin from localhost/sitename.com to http://localhost/sitename.com fixed it.
I think this may have been because wordpress didn't accept the URL without http, rather than because http made apache act differently. |
|
Back to top |
|
|
|
|
|
|