I'm having an issue that I think can be solved with .htaccess, however, I'm not sure exactly how, htaccess rules have never been a strong point for me.
I have a domain with WHMCS installed on it, in a subdirectory, like this:
/websites/manage/
the /websites/ directory is otherwise empty.
Now, I have installed WordPress on the root of the domain, and I want to use the /websites/ location in the WordPress permalink structure, as I want to build a WordPress page that describes the products and services available there, and use it as a gateway to the WHMCS portal located beneath it.
I've tried searching for an answer to this problem, but I keep turning up tons of results about installing wordpress in a subdirectory, and nothing else.
Thanks for your help.
EDIT:
I should have mentioned:
Currently, I get the WHMCS portal when I go to /websites/manage/, which is fine.
However, my problem is that when I go /websites/ I get a directory listing instead of my WordPress page.
I solved this by adding the following to the beginning .htaccess file, before the WordPress section:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/websites/$
RewriteRule . /index.php
</IfModule>
This redirects the /websites/ directory to the /index.php file which WordPress can then use to find its matching page. It still allows the sub directory /websites/manage/ to be controlled by the WHMCS software residing there.
Related
Getting started with a droplet on Digital Ocean, so far it's been a fun process. Now I want to begin migrating my site, so I set everything up and created an index.php to where to my root dir as a "construction" page for now. I'm setting up WordPress in a sub-dir and moved all of the contents via all-in-one WP Migration which has always worked perfectly for me.
I've given every dir and file inside of root/public_html (WordPress installation) rwx and atm ownership has been changed to www-data. So I got to loadup my site which atm would be something like <ip address>/public_html and I log in and I am propmted with the wp-admin screen. Everything is working, media files are uploaded, theme is there etc.
When I go to my home page, all the images load but I immediately notice the admin bar at the top, the wp-glyphs aren't loading and I'm getting those weird squares when your computer/phone doesn't know what it's trying to look at. Also any front-end page other than my home returns a 404. My homepage again is accessed by <ip address>/public_html so you would think my about page would be <ip address>/public_html/about, which is where WordPress is sending me to when clicked, but I receive a 404.
I've spent probably 4-5 hours now trying to figure this out and eventually turned to a guide that walks you through it but nada so far.
Can anyone offer a suggestion?
EDIT
I'd like to add that I followed WordPress's instructions on modifying the .htaccess file. I'm assuming it goes in the subdirectory correct?
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /public_html/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /public_html/index.php [L]
</IfModule>
Just as a reference for myself and anyone who might stumble upon this.
Solution
The answer was that apache was not configured correctly to read .htaccess files. If you are experiencing the same problems and have set up your own VPS, go to apache.conf, etc/apache2/apache.conf and find the correct <Directory></Directory> directive that corresponds with your website directory. Inside you should see an option that reads AllowOverride None. Change this to AllowOverride All.
If this is not the solution for you, at least it's another step out of the way.
Are you able to access wp-admin
If yes then go to dashboard->setting->permalinks
and update the permalink and the problem solved
Access your dashboard by logging in wp-admin then access settings then permanent links, Change them to any of the provided styles save the change it again to your preferred one. This will work well.
So I have one Wordpress install in a sub-directory. (www.mysite.com/wp/)
What I need is for certain pages to remove the WP directory name from the URL.
so 'www.mysite.com/wp/careers' needs to be -> 'www.mysite.com/careers'
I have an .htaccess in the root directory and in the wp directory. I've gotten some of my rules to work when permalinks are disabled in WP, but when those are enabled (which they need to be) the WP .htaccess overrides any rules I have in the root.
Is there any way to have 2 htaccess co-exist in this manner? Sorry I haven't messed with wordpress and apache very much.
Any input is greatly appreciated.
**So I finally got this working, it was just a matter of like you said formatting redirect URL so wordpress likes it.
So in my root htaccess file : for this url mysite.com/careers
RewriteRule ^careers/?$ wp/index.php?pagename=careers [L]
And voila and it started working just fine.
Yes, you can have rules in both htaccess files but it's going to be tricky as wordpress has specific ways that it will expect URLs to look.
In the wordpress htaccess file, above any wordpress related rules, add:
RewriteCond %{THE_REQUEST} \ /+wp/careers
RewriteRule ^ /careers [L,R]
then in the htaccess file in the document root add:
RewriteRule ^careers$ /wp/careers [L]
But again, depending on what wordpress expects the "careers" URL to look like, this may not solve your problem.
So, a client of mine has this Magento site set up:
http://kharmakhare.com
I have actually asked a question about this site before. This time, they want a blog set up at:
http://kharmakhare.com/blog
Yes, there is one already there. They want to replace that AW Blog with a Wordpress blog integrated into the Magento theme with Wordpress. There's just one problem; I can't get the url to change at ALL.
No matter what I do, the blog always appears at:
http://kharmakhare.com/wordpress
I try to disable the AW Blog and test the new one at:
http://kharmakhare.com/blog
But nothing happens. The above url simply redirects to the main site.
All of my Wordpress Integration settings are green (except for "improve your blog"). If I disable Wordpress Integration in the settings, the /wordpress directory STILL appears.
In Wordpress, the site url is set to /blog. The wordpress url is /wp. Whenever I try changing the permalink settings Wordpress fails to create the .htaccess file, so I did it manually... but it always uses /blog in the settings:
<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>
Not that it matters much. Even with it set to:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
</IfModule>
It still doesn't work.
This has been a real, real pain to set up. The documentation says its easy, everything I've read says its easy. It just plain won't work for me. I even tried reinstalling the plugin. Then I tried uninstalling and reinstalling the plugin. I also tried (before this) uninstalling and reinstalling wordpress. Nothing works.
I can NOT delete the AW blog without having the new blog to replace it. I can disable the AW blog temporarily, but I can't delete it. Is there anything that I'm missing?
Any help would be greatly appreciated.
Firstly, upgrade WordPress Integration to the latest version and uninstall AheadWorks Blog extension.
Secondly, I assume that you have installed WordPress in a sub-directory other than 'blog'. For this example, I will assume you have installed it in 'wp'.
To make your blog viewable on /blog, set your Blog Route as 'blog' and your WordPress path as 'wp'. Next, login to WordPress and select Settings > General and change the second URL option (labelled Site address (URL)) to http://www.yourmagentourl.com/blog
You should now be able to view your blog at the /blog URL.
Finally, if WordPress is installed in /wp and visible at /blog, your .htaccess file should reference /wp/ and not /blog
The solution is easy. First fully disable AW_Blog. Don't just disable this via the configuration or via System > Advanced. Either fully uninstall it or delete the app/etc/modules/AW_Blog.xml file and then refresh the cache.
The AW_Blog module uses - rather selfishly - 'blog' as it's frontName. The frontName takes precendence over the dynamic routing system used in Magento WordPress Integration so while AW_Blog is installed, you can't use 'blog' as your WordPress URL.
With AW_Blog fully uninstalled, enter 'blog' as the blog route in the extensions configuration. Finally, login to the WordPress Admin and select Settings > General. Here you will see 2 URLs. The first URL should be the true WordPress URL (if WordPress is installed at /wp then this should be the /wp URL). The second URL should be the integrated Magento URL (eg. the /blog URL)
The WordPress .htaccess file has no effect as this only runs when actually accessing WordPress and isn't ran when accessing Magento.
Hi this is more of a question clarification (disclaimer) as I am having what may be a related issue.
What happens when you visit http://WWW.kharmakhare.com/blog rather than the shorter url? For me at the moment- www.magento.com/blog resolves correctly whereas magento.com/blog sends me to the home page.
Also, have you tried setting the full path in the wordpress settings? Your question indicates you have set it to /blog rather than the full http://kharmakhare.com/blog ? I believe it should include the full file path.
Ok, I think this must be a bug in the plugin. The ONLY way I could get this to work is to edit the Fishpig plugin's core so that the default route is "blog."
Not an ideal solution, but at least it works. This should not be such a problem, though, the plugin should work as its intended without modifying the core files.
when dealing with the Wordpress plugin, be sure to clean magento cache (better disable it during editing) and clear your browser cache as well.
Changing routes around between magento and the Wordpress plugin, quickly becomes a nightmare when dealing with invalid caches.
Also check your URL rewites as sometimes as a last resort, a webshop owner will use this to make things work.
I have a wordpress site that is currently running in a subdirectory of my website, basically put my structure is as follows:
root/wp
I'd like to keep the wordpress wp folder in the same place however have it load the wordpress site directly from the root url.
For instance currently the site loads when I go to www.mysite.com/wp however I'd like to have the wordpress site load when I simply go to www.mysite.com - currently if I go to www.mysite.com it simply loads an 500 Internal Server Error message.
I would expect I'd need to make some changes to the htaccess files - can anyone suggest how this would be done
So in a nutshell
When I go to www.mysite.com - it looks at the /wp folder but still appears as www.mysite.com in the address bar.
Adding these lines to .htaccess should do the job (not tested, sorry, it may not be sufficient):
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteRule ^(/)?$ wp [L]
Update: You might wish to check https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory for a way to accomplish this that's closer to WordPress standards.
Hi I have a domain running in WordPress,
the path to WordPress installation is /subdomain/mywordpress/ and I can access these in mywordpress.mysite.com, Now I wish to load the index page on my main domain, ie
When I goto mysite.com I want to load the Index page of the WordPress, I know if that possible, the links are always pointing to mywordpress.mysite.com, but that is what I need know. because I dont want to remove the mywordpress.mysite.com. I just need to display all posts on my main site, with same design(that is why I prefer to load the Index file of wordpress)
What about a simple mod_rewrite rule inside a .htaccess to redirect to mywordpress.mysite.com?
This should work:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule . /subdomain/mywordpress/index.php [L]
You should look at this article in the Codex: Giving WordPress Its Own Directory. It addresses exactly the situation you are describing.