I really really hope someone can help with this becuase its got me going mental.

I have a local Wordpress install at http://localhost/domain and a live version of the same install at http://www.domain.com.

The trouble I'm having is getting the permalinks to work on both sites at the same time. Currently I have 2 different .htaccess files one for live and one for local and the Wordpress url set to http://localhost/domain. Which is working fine except the site can't be viewed outside of the local install (i.e. at http://www.domain.com from a outside machine).

As soon as I set the Wordpress url back to http://www.domain.com the local permalinks throw a 404 although the live site functions fine and can be viewed externally again.

mod_rewrite is working fine and so are non-pretty permanlines (i.e. /?p=2).

Can anyone shed any light on this?

Local .htaccess

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

Live .htaccess

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

4 answers

0
points
This was chosen as the best answer

@dityo.

This doesn't acutally mate any difference as we're using a live database mean if we change it for the live site it also changes for the local site and visa-versa.


As it happens we've fixed this issue by creating a virtual host in Wamp (or Xampp) and using that as the root. Its a little bit of messy set up each time but it works.

Thanks for your help anyway.

Answered almost 8 years ago by Lee Simpson
0
points

@ash

This doesn't have anything to do with live site, its all on my local server.

The live site is working fine but permalinks aren't working locally and aren't recognising that there is pages if you use i.e /about, /contact.

Answered almost 8 years ago by Lee Simpson
0
points

As far as I know, .htaccess modification will be not give any affect of to permalink. You don't need to touch the .htaccess.

You need to change the blog url on your wordpress admin. There several options needs to be change the value on wp_options table in your WP database, find the following value on option_name field using your favorite MySQL Administration tools:

  1. siteurl
  2. home
  3. upload_path

Make sure the permalink option at WP administration once more to regenerate the .htaccess. Quite irritating steps, right? hopes work.

Answered almost 8 years ago by Dityo Nurasto
0
points

Can you verify that mod_rewrite is enabed on the remote server? That is, do you have an instance of a URL where mod_rewrite is in fact transforming the URL properly?

Non-pretty permalinks actually have nothing to do with mod_rewrite or .htaccess files at all. Those types of URLs will work no matter what, even if .htaccess does not exist.

Answered almost 8 years ago by Ash White