0

I have posted this question on bitnami answers as well but I am refining it here. The relevant link is:

I am running the bitnami wordpress stack on my Kubuntu Linux machine. I am linking to pages internal to my site in my content with absolute links like this /index.php/page-name and my server is running at http://127.0.1.1/wordpress/. The appropriate relative links work correctly but the absolute links do not.

The behaviour I am getting with the absolute links is that the /wordpress/ path component is truncated when using /index.php/page-name and points to http://127.0.1.1/index.php/page-name instead of http://127.0.1.1/wordpress/index.php/page-name.

I am using the Post name permalink structure and my .htaccess file also has the following rewrite rules:

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

# END WordPress

Every time I click the link I get a 404 error with this message in the apache error log:

script '/home/nandu/wordpress-3.3.1-1/apache2/htdocs/index.php' not found or unable to stat

I am not sure why the wordpress part of the URL is getting cut off when my settings in the admin area show both the site url and address url pointing to http://127.0.1.1/wordpress.

Furthermore according to the wordpress codex /index.php/ should point to the site root.

I am at my wits end as far as this problem is concerned. Kindly do let me know if you require any more information.

Thanks in advance. nav

nandac
  • 335
  • 3
  • 16

2 Answers2

0

I'm not sure why you're trying to write your links via index.php. You should create links that match the permalinks that WordPress itself would produce. So, instead of /index.php/page-name, you would put /wordpress/page-name.

stevevls
  • 10,675
  • 1
  • 45
  • 50
  • Thank your for your reply. These absolute links work on my production site flawlessly and I wanted to keep the same url structure on my development site. Just to clarify my permalink structure is `http://127.0.1.1:8080/wordpress/sample-post/` and my understanding was that `/index.php/` matches `http://127.0.1.1:8080/wordpress` – nandac Apr 10 '12 at 09:37
  • Perhaps you have a different `.htaccess` in production? As currently written, the one you've posted *won't* map `/index.php/` to `http://127.0.1.1:8080/wordpress`. Your rules are prefaced with `RewriteBase`, which is a way to say "for all links starting with...". Then it says to directly pass through a URL ending with `index.php`. Then it's saying to send any URL that doesn't reference an actual file or directory to `/wordpress/index.php`. So given all that, you'll need to have at least the leading `/wordpress`... – stevevls Apr 10 '12 at 09:49
  • Yes my .htaccess file is different on production. If I were to make the .htaccess file on development the same as production and change my siteurl address to just plain `http://127.0.1.1:8080/` that should work am I correct? Or is there another way to change my .htaccess so that index.php maps to `http://127.0.1.1:8080/wordpress`. My knowledge on .htaccess files is very limited I am afraid. – nandac Apr 10 '12 at 09:59
  • Whenever possible, have your development environment mirror your production server exactly...that's the best way to avoid mixups later. :) I would definitely copy down your `.htaccess`, change your siteurl, and then see where you stand. – stevevls Apr 10 '12 at 10:37
  • Thanks @stevevls I have succeeded in getting my bitnami to act like my production system after much effort and have put up an answer of the steps to follow. – nandac Apr 11 '12 at 02:12
0

I have succeeded in getting my bitnami wordpress stack to run wordpress on the root url http://127.0.1.1/ so that the links in my content will work identically to my production system.

Here are the steps I followed modify to suit your needs:

  1. Edit the following lines in /<INSTALL_DIR>/apache2/conf/httpd.conf

    from:

    DocumentRoot "/<INSTALL_DIR>/apache2/htdocs"

    to

    DocumentRoot "/<INSTALL_DIR>/apps/wordpress/htdocs"

  2. In the same file, also change the following directive

    from

    <Directory "/<INSTALL_DIR>/apache2/htdocs">

    to

    <Directory "/<INSTALL_DIR>/apps/wordpress/htdocs">

  3. Go to /<INSTALL_DIR>/apps/wordpress/conf/wordpress.conf and comment out the following lines by prepending a #:

    Alias /wordpress/ "/<INSTALL_DIR>/apps/wordpress/htdocs/"

    Alias /wordpress "/<INSTALL_DIR>/apps/wordpress/htdocs"

  4. In the same file change

    from:

    RewriteBase /wordpress/

    to

    RewriteBase /

  5. In the same file, uncomment the following lines by removing the #:

    #RewriteEngine On

    #RewriteRule ^/$ /wordpress/ [PT]

  6. Restart the bitnami apache server:

    /<INSTALL_DIR>/ctlscript restart

  7. Edit the following lines in /<INSTALL_DIR>/apps/wordpress/htdocs/.htaccess

    from:

    RewriteBase /wordpress/

    to

    RewriteBase /

    and

    RewriteRule . /wordpress/index.php [L]

    to

    RewriteRule . /index.php [L]

  8. Login to PHPMyAdmin at http://127.0.1.1/phpmyadmin and go to the wp_options table change siteurl value

    from:

    http://127.0.1.1/wordpress

    to

    http://127.0.1.1

  9. After this rename the index.html file in the /<INSTALL_DIR>/apache2/htdocs/ directory to old-index.html

  10. Restart the bitnami apache server:

    /<INSTALL_DIR>/ctlscript restart

Navigating to http://127.0.1.1/ should show the homepage of the site. There is some documentation on the bitnami wordpress docs about what needs to be done to change the root url but they seemed incomplete in terms of what I had to do to accomplish this.

Hope that helps someone. :-) nav

nandac
  • 335
  • 3
  • 16