We have a wordpress blog hosted in a different from our web application. For SEO concerns, we decided to rebuild the blog on the same server as our application.
It already has a Apache2 running with the root path directing to our Symfony application /web folder.
We installed Wordpress in var/www/wordpress, set the permissions on this folder for Apache2 and configured the DB connection. The homepage of our wordpress is visible on the /content path (www.mysite.com/content).
For that, I added a single to my existing apache2 conf :
Alias /content /var/www/wordpress
We started building the homepage, uploaded themes, everything works fine. But when we want to add a new page (ie. /content/blog), we get a 404. Resetting the permalinks does nothing. Setting the permalink mode to ?pageId=XXX allows us to see the new page, but that's not what we want.
Did I miss something in my apache configuration ? Any idea ?
Thanks
In case anyone stumble upon this looking for an answer, I had to add some configuration to Apache for my site :
<Directory /var/www/wordpress>
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
<Directory /var/www/wordpress>
Options FollowSymlinks
</Directory>
Related
Background
As someone who develops multiple websites I wanted to be able to serve each site from within its respective project folder in the filesystem, instead of serving them all under the htdocs directory.
So I moved my wordpress folder (whose site was usually accessed via localhost/wordpress) to my project directory, and followed the instructions in this answer to set up a virtual host with a DocumentRoot and Directory that matches the new location of the wordpress folder. This is the whole (uncommented portion) of my httpd-vhosts.conf:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "D:\Users\User\Documents\Projects\Websites\My New Project\wordpress"
ServerName localhost.irm
<Directory "D:\Users\User\Documents\Projects\Websites\My New Project\wordpress">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
The Problem
The homepage can now be found at localhost.irm, but it's text-only, with no styles or images, and clicking on any page takes me to an "Object not found!" XAMPP page.
What I've Tried
Accessed the database with PHPMyAdmin, changing siteurl and home in the wp_options table to reflect the new domain
Used the WP-CLI tool to search-and-replace all database instances of the old domain with the new one
Unfortunately none of these solved the problem.
This seemed to be primarily caused by two problems:
The Site Ground Optimiser plugin from my live site that I wasn't even aware was activated on my local site. Deactivating using wp plugin deactivate sg-cachepress (the WP-CLI tool) solved that.
The following line in my .htaccess file, at the root of my Wordpress site:
RewriteBase /wordpress/
I assume it must have been necessary to add for my previous setup and I'd since forgotten about it. Either way, removing/commenting the line out entirely seems to have solved the rest of the problem.
I'm now able to access my website with all styles and images, just like I was before, with the advantage that my files are now being served from my project folder itself instead of from XAMPP\htdocs.
I successfully installed Laravel and Laravel Nova in live server but when I tried to view Nova login page, I get index of/nova page and the page does not redirect any css.
Below is the screenshot of the page rendering:
In the config/nova.php the path is correctly set to:
config/nova.php
I need help to get this page to display correctly.
I found what the problem was. I got index of/nova because Laravel Nova login page was looking for the css folder, js folder, .htaccess, web.config from the root directory and it could not find then it displays index of/nova.
When I moved css folder, js folder, .htaccess, web.config to the root directory, then voila I get the login exactly as I wanted.
Below is the correct display of laravel login page:
Thanks everyone who tried their best to help.
In your case the problem might not be with the web application but with the settings of the webserver.
I use Apache and this is what my 'virtual hosts' (httpd-vhosts.conf) configuration looks like for one web application:
<VirtualHost *:80>
ServerName laraveltest1
DocumentRoot "c:/users/jorisj1/source/repos/laraveltest1/public"
<Directory "c:/users/jorisj1/source/repos/laraveltest1/public">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
In your case the DocumentRoot might point to the actual root of the application. Try changing it to the public directory.
I have a Ubuntu server with 2 websites on it. I can navigate to one, but not to the other. Here are the details:
Each website has a user with the same name as the group and as the subfolder. Sites are hosted under
/home/site1/public_html and
/home/site2/public_html
Now in my case site1 is called from a subdomain, but it works just fine, so if I navigate to site1.mydomain.com it opens up the CodeIgniter page and I can navigate with no issues (I have .htaccess here to get rid of index.php in the url).
However when I try to navigate to www.site2.com which points to /home/site2/public_html it gives me a 404 error. So to troubleshoot, I added a /home/site2/public_html/index.html simple file and I can see that if I navigate to www.site2.com, however I can't see it if I navigate to www.site2.com/index.html. Also, in my case, I have a subfolder (with same name as the site = "site2") where CodeIgniter code/folder structure is and I just can't get tot that index.php from code igniter at all (path to it is /home/site2/public_html/site2/index.php). I tried to navigate as www.site2.com/site2/index.php or www.site2.com/index.php with or without htaccess file but with no help. I tried to remove the .htaccess in this site, I tried to create a test.html in /home/site2/public_html/site2 but I can't navigate to it, I get 404 if I do www.site2.com/site2/test.html
in terms of user access I used $ chmod -R 755 /home/site2
Is it an access right that I am missing? Or a conflict with the other .htaccess from the other virtual folder? No clue... and I am just running out of ideas
V Host Settings
ServerName site1.mydomain.com
ServerAlias site1.mydomain.com
DocumentRoot "/home/site1/public_html"
<Directory "/home/site1/public_html">
AllowOverride All
allow from all
Options Indexes FollowSymLinks MultiViews
Require all granted
</Directory>
and for the one I've trouble with
ServerName www.site2.com
ServerAlias www.site2.com
DocumentRoot "/home/site2/public_html"
<Directory "/home/site2/public_html">
AllowOverride All
allow from all
Options Indexes FollowSymLinks MultiViews
Require all granted
</Directory>
NOTE : I just made a subdomain site2.mydomain.com (domain registered with FatCow) and that seems to be working, it does not work only when I call it with www.site2.com (register under GoDaddy - which gives a GoDaddy "Destination unknown" page which I assumed it is a 404 error and always asks me to Accept cookies ... and I am on a diet :P )
Thanks anyone in advance!
oh darn thing, you were right #sintakonte, one site was pointing somewhere else. Go daddy had a A record with old IP address, I added another A record and asked them to park the original (as I had no rights to do so from their website). And problem got resolved. Thank you!
This seems like very trivial, that its a .htaccess file issue, but it isn't.
I have a wordpress site, which was running at say demo.xxx.com I had to move it to xxx.com
so i just went to my apache and change the files to redirect the same to xxx.com and not to demo.xxx.com
i also went in wordpress and changed the url related settings from demo.xxx.com to xxx.com
the directory thus is the same for this source code.
the home page opens well, at first i thought may be i should reset all the permalinks, which i did but the inner pages refuse to open.
my .htaccess file is same as before, I don;t think there is anything wrong about it.
Have you tried to go to Settings -> Permalinks and choose a setting different from Default, then click the Save button?
When you directed Apache to go to your new site, was it in a different directory? If so, you probably don't have the same directory permissions. Permalinks use mod_rewrite and won't work unless Overrides are enabled.
Check and change your httpd.conf file...
<Directory "/var/www/xxx.dom">
AllowOverride None
</Directory>
to
<Directory "/var/www/xxx.dom">
AllowOverride All
</Directory>
I am currently working on a wordpress multisite project. I have set up a working environment in localhost. In the main menu there is a links to home, so is in subdirectory sites. Now my problem is everything works find in testing server environments as the main site URL is myhost/xx/wordpress_site and sub directory sites are like myhost/xx/wordpress_site/sub_dir. In wordpress Appearance->menu you can only give a static url in the link URL field. What I am looking for is to give a method like site_url().”/sub_dir” in that field so I don’t have to manually alter all the site home URLs when I upload the site to it’s destination domain. Which can be any form?
Any simple solution regarding this problem its greatly appreciated.
Thanks a lot.
I would not recommend to change anything on wordpress code or site url configuration.
because when you will go to production you will have to change it back again.
It will be the best if you will setup the same site configuration on your localhost, you can use the following configuration for your apache server and host file so you will be able to
access your local site by your actual domain.
This way your settings will remain the same and all site links will be the same.
(rename mysite to your site url)
how to change host file:
http://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/
how to add virtual host apache:
http://httpd.apache.org/docs/current/vhosts/examples.html
Apache configuration:
<VirtualHost mysite.com:80>
ServerName mysite.com
DocumentRoot /var/www/mysite
<Directory /var/www/mysite>
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
host file configuration:
127.0.0.1 mysite.com
restart apache and you will be able to work on localhost like it is the productin server.
* Remove the following when you want to access the real server.