I have a Ghost blog installed on shared hosting. I can access the blog by going to blog.my-domain.com:2368.
I want the blog to work when I go to http://blog.my-site.com/ but that doesn't work. This is the page I see:
// # Ghost bootloader
// Orchestrates the loading of Ghost
// When run from command line.
var ghost = require('./core');
ghost();
How do I fix this error?
I discovered a solution. As it turns out port 80 was already being used. This is why it wouldn't work. I had to create a .htaccess file to solve the problem:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^blog.example.com$ [NC]
RewriteCond %{HTTPS} off
RewriteRule ^ http://blog.example.com:2368%{REQUEST_URI} [P,QSA,L]
You replace blog.example.com with your URL for your Ghost Blog.
Source of Information
Related
Long version (you can skip to TL;DR if you want to):
I am working with a Wordpress site that was set up by someone else. The website has multiple pages where page has tabbed content which is accessible through #. For eg:
www.example.com/services/category1/#tab-service1
www.example.com/services/category1/#tab-service2
www.example.com/services/category2/#tab-service1
www.example.com/services/category2/#tab-service2
www.example.com/services/category2/#tab-service3
Now, when search engines index they are indexing only www.example.com/services/category1/ and www.example.com/services/category2/. This creates a problem where we cannot have search engines point directly to the content within a given tab. What we want is for search engines to show links that takes users directly to (say) www.example.com/services/category2/#tab-service3.
Now, I don't think google can index such # based content on its own. So, I am thinking of using apache rewrites to try to resolve this issue. I have access to .htaccess file only (from a config perspective).
TL;DR
How to redirect www.example.com/services/category1/service3/ to www.example.com/services/category1/#tab-service3 using apache redirects (I have access to .htaccess file)?
This is what I am trying but it's not working:
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/services/category1/([a-z0-9])/? [NC]
RewriteRule .* /services/category1#tab-%1 [R,NE,L]
Someone also adviced to look into pushState server config to fix this. I am not sure how to use pushState.
UPDATE:
I have updated the rewrites to the following but it still doesn't work. It keeps showing Wordpress' 404 page
<IfModule mod_rewrite.c>
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /domainfolder/
RewriteCond %{REQUEST_URI} ^/services/category1/([a-z0-9]+)/?$ [NC]
RewriteRule ^/services/category1/([a-z0-9]+)/?$ /services/category1/#$1 [NE,R,L]
</IfModule>
Your %{REQUEST_URI} regex is wrong. The pattern ^/services/
category1/([a-z0- 9 ])/? matches /services/category1/{any 1 char of a-z or 0-9} format followed by an optional slash. So this does not match your request /services/category1/service3 but matches /services/category1/a/ .
You should be using
^/services/category1/([a-z0-9]+)/?$
I have a wordpress setup with Network admin enabled.
And I have following different sites configured.
http://example.com/ipl ,
http://example.com/cricket,
http://example.com/football,
http://example.com/ileague,
http://example.com/sports
But what I want to configure is the following without redirecting (URL should not change in the address bar)
http://example.com/sports/cricket should serve content from
http://example.com/cricket
http://example.com/sports/cricket/ipl should serve content from http://example.com/ipl
http://example.com/sports/football should serve content from http://example.com/football
http://example.com/sports/football/ileague should serve content from http://example.com/ileague
Please add following code in .htacess file.
RewriteRule ^sports/cricket/ipl?$ /ipl [NC]
RewriteRule ^sports/cricket?$ /cricket [NC]
RewriteRule ^sports/football/ileague?$ /football [NC]
RewriteRule ^sports/football?$ /football [NC]
I have seen some other posts on SO about this issue, however none of the suggested solutions did work for me, so I repost.
After changing my permalink structure to /%postname%/, none of the links is working. I get the following 404:
Not Found
The requested URL /my-post-name/ was not found on this server.
Apache/2.2.20 (Ubuntu) Server at mysite.com Port 80
When I get back to the default permalink structure it starts to work again, but I want to have /%postname%/ structure anyways.
My .htaccess file's chmod is 777.
After updating my permalink structure to /%postname%/, the .htaccess file generated by Wordpress is the following:
# 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 thoughts?
Edit:
I tried to change permalink structure to the following:
/index.php/%postname%/
and it happily worked. However, the problem is now, not surprisingly, the links are in the following form:
www.mysite.com/index.php/my-page.com
My question is how can I remove index.php from my links. When I remove it from the permalink structure (i.e., /%postname%/), my links no longer work.
PS: Instead of using blog entries I use only pages in my site. If it is necessary my site is: mll.sehir.edu.tr.
There are many ways how you can fix this issue, if you know the root of the issue.
Problem 1
Firstly, it may be a problem with your apache not having the mod_rewrite.c module installed or enabled.
For this reason, you would have to enable it as follows
Open up your console and type into it, this:
sudo a2enmod rewrite
Restart your apache server.
service apache2 restart
Problem 2
You may also, in addition to the above, if it does not work, have to change the override rule from the apache conf file (either apache2.conf, http.conf , or 000-default file).
Locate Directory /var/www/
Change the Override None to Override All
Problem 3
If you get an error stating rewrite module is not found, then probably your userdir module is not enabled. For this reason you need to enable it.
Type this into the console:
sudo a2enmod userdir
Then try enabling the rewrite module if still not enabled (as mentioned above).
To read further on this, you can visit this site: http://seventhsoulmountain.blogspot.com/2014/02/wordpress-permalink-ubuntu-problem-solutions.html
Sounds like a problem with symlinks on your server. Try this in your .htaccess and also please change it to 644 after making the change:
Options +FollowSymlinks
RewriteEngine on
# 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
I had the same problem but i am using other url structure /%category%/%postname%/
The problems with de 404 error is because even if you set a certain structure, wordpress is always trying to create the urls with the word "category" on the url.
Try to type your urls like this: yoursite.com/category/postname, if you are not getting any error now is because we are close to resolving the error. Now try to install this wordpress plugin http://wordpress.org/extend/plugins/no-category-base-wpml/ to remove the "category" base from urls
Let me know about your progress
Replace and try your .htaccess with this:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^hostname.com$
RewriteRule ^(.*)$ http://www.hostname.com/$1 [R=permanent,L]
I got this issue whenever i try to enable my site's permalink to mod_rewrite: "Pretty Permalinks". My site is one instance on AWS EC2.
404 Errors
Page Not Found
The requested URL .... was not found on this server.
Apache/2.4.7 (Ubuntu) Server at mydomain.com Port 80
I tried all above methods, but not being fixed.
At last, I checked the /etc/apache2/sites-available/wordpress.conf, I found I used public IP address assigned to each instance by AWS. Once I change it to the current mydomain.com, it's working.
Sometimes, wordpress.conf would be locked by httpd (web serser), we need to stop and start it after edit. We also need to use: sudo service apache2 stop/start so as wordpress.conf could be reload again.
Hope my experience could help others.
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
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.
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:
Edit the following lines in /<INSTALL_DIR>/apache2/conf/httpd.conf
from:
DocumentRoot "/<INSTALL_DIR>/apache2/htdocs"
to
DocumentRoot "/<INSTALL_DIR>/apps/wordpress/htdocs"
In the same file, also change the following directive
from
<Directory "/<INSTALL_DIR>/apache2/htdocs">
to
<Directory "/<INSTALL_DIR>/apps/wordpress/htdocs">
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"
In the same file change
from:
RewriteBase /wordpress/
to
RewriteBase /
In the same file, uncomment the following lines by removing the #:
#RewriteEngine On
#RewriteRule ^/$ /wordpress/ [PT]
Restart the bitnami apache server:
/<INSTALL_DIR>/ctlscript restart
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]
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
After this rename the index.html file in the /<INSTALL_DIR>/apache2/htdocs/ directory to old-index.html
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
the problem I have with the multilingual plugin (qTranslate), is that it won't switch to another language it gives me 404 when trying to switch the language of posts.
This can be a result of either:
* WordPress is installed in a directory (not root) and you're using default links.
* URL rewriting is not enabled in your web server.
* The web server cannot write to the .htaccess file
I have my htaccess file with 644 and the following code is in there:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
And I'm using a custom permalinks structure: /%category%/%postname%/
but I still have 404 when trying to switch language.
anybody knows what else could be adffecting the translation plugin?
i don't know if this can help, but i had a kind of similar issue, only with the search results. with method get it was working fine for the main language, but english made 404, with method post for english, and german went to the home-page.
then i changed the url in the wp general settings from abc.com/def to abc.com (i had the directory in both fields and removed it from both). wp is not in www, but www-directory is redirected to the wp-folder. so the subdir was not necessary anymore (had it put for development). and, don't know why, but after this, the post method-search worked well like described in the wp-forum ( http://www.qianqin.de/qtranslate/forum/ ) where you can find lots of useful tips for qtranslate issues. also applying the gettext might help: http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=294&sid=5be0c994e226ab99b5bed7c28a250bab
hope this helps.