0

I am trying to develop Wordpress on my local Ubuntu laptop.

On the remote production and staging servers, I can access a page like this via the browser:

http://remoteDomain.com/somepage/

On my local machine it is:

http://localhost/index.php/somepage/

Most things work fine, because local permalinks just contain the "index.php" part (and I'm not working on code, not content), but when I use something like get_site_url() it suddenly becomes an issue if I'm on the live site or my laptop.

I know there is some kind of standard DNS thing to deal with it so that $X = get_site_url(); would give me a useful link on both my remote sites and my laptop. What do I do? The best solution would tell me how to eliminate the "index.php" from the URL itself so that my local machine would mirror the remotes.

Thanks Rarst.

If I use any of the default permalink structures ["plain", "day and name" etc." it just breaks. I get a message from Apache:

Not Found
The requested URL /cart/ was not found on this server.
Apache/2.4.7 (Ubuntu) Server at localhost Port 80

If I set the permalink structure to:

custom: index.php/%postname%/

Basically, everything works. Except if I'm trying to somehow reference a post or page in a plugin. i.e. I know the title and the permalink are the same, [i.e. title:"hello-world" URL:"http://domain.com/hello-world/"] so:

$URL = get_site_url() . $title;

On my local machine I can't do that because it's forcing me to add this extraneous "index.php" to the permalink.

Anyway... I don't care because I have a few other issues with this laptop. I'm going to wipe it and put a fresh Ubuntu install on it anyway. Hopefully this will just magically go away.

  • You probably want to be developing in the same environment that you'll use in production. What server stack are you using locally? In the end, this is a webserver configuration issue, not a WordPress issue. – Jeremy Ross Sep 6 '16 at 16:40
  • @JeremyRoss please note server configuration for WordPress is considered in scope here. :) – Rarst Sep 6 '16 at 18:28
1

What you have locally is called PATHINFO permalinks. It is quite rare configuration since permalinks are either "pretty" (what you have live) or "ugly" (no rewrite at all, GET requests).

It is hard to guess why you ended up with PATHINFO configuration if you haven't deliberately configured it. Might you have used some tool to install WP for you?

You should check your permalink settings and go through relevant documentation. Overall this depends on your existing configuration, your webeserver, and modules it has available. No universal solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.