WordPress Inside Magento URL Rewrite Method Issue - wordpress

This may look like already submitted question. But sure it's not. Before getting into what I need, I tried these ways which found on stack,
.htaccess Method
vhost Method
Apache Config Method
Combining with all above or using individual specified methods. But I couldn't get my requirement. So only I posted this question and here my question.
I have my site like this, magento in root directory and wordpress as wp and the folder structure like this,
app/
downloader/
errors/
....
var/
....
wp/
....
index.php
....
Now I can access magento and wordpress like this
www.store-url.com - Magento
www.store-url.com/wp/blog/ - Wordpress
But I need to access like this.
www.store-url.com - Magento
www.store-url.com/blog/ - Wordpress
So far the solutions I found works correctly upto the /blog/ but anything after that is not working for me, Like,
www.store-url.com/blog/any-identifier-here/
www.store-url.com/blog/any-identifier-here/identifier-2-here/
doesn't works for me. I am looking for best rewrite option that enables me to work like above url.
I tried the below but not working,
.htaccess - Wordpress under Magento site with multi language sub directories
htaccess multi language site with sub directories, and default 301
Endless Redirect Loop by htaccess rules multi language
Please someone help me..
Thanks!

Related

Trying to rewrite URLs for wordpress / nginx / WPML install

I have some wordpress experience, but it's my first time using Nginx. I have a WordPress installation running on Nginx. I added WPML (multi-language plugin) https://wpml.org/
The current URL structure is https://www.maindomain.com/blog/es/.... & https://www.maindomain.com/blog/en/.... etc. Everything works fine.
I'm looking for a way to rewrite the URLs in ninginx conf for the whole set-up to work with: https://www.maindomain/es/blog/.... instead of https://www.maindomain.com/blog/es/ and so on.
I tried several things and eventually i got stuck on:
rewrite ^/blog/en/(\w+\.?.*)$ /en/blog/$1 last;
which gives a 404 error on both URLs.
Any ideas on how to do this? Or is there a better way of doing this other than with rewrites?
...is there a better way of doing this
Possibly, yes. You can install WordPress in a root directory instead of a subdirectory (/blog) or point the domain to the subdirectory. This will give you URLs like maindomain.com
You can then set the Language URL setting in WPML to "Different languages in directories". This will give you URLs like maindomain.com/es/. Finally, you can create a page with the blog slug in WordPress (you should be able to set the same slug for the translation) and it will be accessible at maindomain.com/blog or maindomain.com/es/blog.

Multiple RewriteEngine calls, or another way to solve this problem?

I have Wordpress multisite installed at the root of my site (the Wordpress files are actually in /wp, but it's configured so that each subsite URL is at the root - eg. /site1, /site2 etc.) This means that there's a Wordpress section in my .htaccess file that I probably shouldn't be touching, because Wordpress might overwrite those changes.
However! There is a redirect I would like to build, from (say) /path/to/oldsite to :8080/newsite, and I don't know how to do this without RewriteEngine. Other redirects I have managed to do basic 301s with, but I don't know how to redirect to a different port that way. My test attempt to have multiple sections that use RewriteEngine didn't work since apparently only the final RewriteEngine section gets heeded?
Anyway, that's my issue. Any suggestions for the best way of building this redirect? Am I just going to have to create empty directory /path/to/oldsite to put a redirect in?
Thanks!

How to access Wordpress admin panel after integration with Codeigniter?

In the company where I work we used to have Wordpress on its own subdomain, like blog.ourwebsite.com. We decided that it would've been better to have it in the main domain, like: ourwebsite.com/blog. Also, we want it perfectly integrate with our current design, so the blog should load inside the website showing just the posts, while the header and the footer will be the one of our website. Our website is built with Codeigniter.
I've read different articles and questions about how to integrate the two platforms and in the end we opted for putting Wordpress inside the root directory of the Codeigniter installation, so that it looks like this:
ourwebsite/
application/
system/
wordpress_blog/
In the Codeigniter index.php I am loading Wordpress with this instruction:
require_once './wpblog/wp-blog-header.php';
I put it on top, so before loading the codeigniter core. At this point the only problem was the site_url function conflict which I solved by renaming it in Codeigniter. So, everything seems to work fine except that I have no idea how to access the Wordpress administration panel.
I then created a blog controller and I can now call Wordpress functions inside the Codeigniter view. So at this point the Wordpress content is displayed correctly. The problem is that I have no idea how to access the Wordpress admin panel. If I try to access localhost/ourwebsite/en/blog/wp-admin I, of course, get an error, because it's trying to access a wp-admin function inside the controller, which doesn't exist. So I was thinking to access directly the directory with something like localhost/ourwebsite/wordpress_blog/wp-admin (wordpress_blog is the name of the directory on disk, which is different from the controller name), but I get a 404 error. I also added this directory to the Codeigniter .htaccess file that now looks like this:
RewriteEngine on
RewriteBase /ourwebsite/
RewriteCond $1 !^(index\.php|wordpress_blog|cache|captcha|fonts|forum|media|img|min|css|js|scripts|images|uploads|docs|robots.txt|sitemap.xml|sitemap|public|tools|assets|xd_receiver.htm)
RewriteRule ^(.*)$ index.php/$1 [L]
Any idea?
EDIT:
I tried accessing directly the wp-login.php file, at http://localhost/~carlo/ourwebsite/wordpress_blog/wp-login.php. This actually works. The thing is that when I try to login it redirects me to a wrong url, which is: http://localhost/~carlo/ourwebsite/wordpress_blog/wp-admin/localhost/~carlo/ourwebsite/wordpress_blog/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%2F~carlo%2Fourwebsite%2Fwpblog%2Fwp-admin%2F&reauth=1.
The thing is that it logged me in anyway, so if I try to access the admin panel again, now, it kind of works. I can see it but it's like it has no css or javascript files loaded.
ok then try to change the wordpress siteurl in option table. it should be like localhost/ourwebsite/wordpress_blog/..
and check your
localhost/ourwebsite/wordpress_blog/wp-admin
edited 2/11/2014
define('WP_HOME','http://localhost/~carlo/ourwebsite/wordpress_blog/');
define('WP_SITEURL','http://localhost/~carlo/ourwebsite/wordpress_blog/');
you are missing "http://"

Rewrite Magento url to Wordpress page

I have a Magento site installed at the root of my domain and a Wordpress installed in a subdirectory. Currently I access my sites like this:
Magento: "domain.com"
Wordpress: "domain.com/blog"
I would like to be able to use Wordpress Pages seamlessly, without the "/blog" subdirectory showing in the url, such as:
Wordpress Page-X: "domain.com/page-x"
Note that I do want to keep the "/blog" subdirectory showing normally for blog posts etc... I just don't want it for Wordpress Pages.
Could anybody help on how to set that up? I was think tweaking the .htaccess would've work, but I can't find out how. Other solutions are welcome too. Thank you.
Magento provides you with an option to create custom URL rewrites in the backend (admin) you can find it here. This way you should be able to create rewrites. Also if you want to automate the creation of rewrites you can refer to the core_rewrites table in magento's database. Also this is a good read if you want to do logic based rewrites on the fly.

Sub domain redirect (htaccess)

There is soooo much information about htaccess redirect that I think I'm lost.
Here is my current structure
/web/
/web/CMS/
In the root I have a vBulletin forum and in /CMS/ I have wordpress. (Ideally I should have vBulletin in a /FORUM/ folder maybe?)
I'd like to setup something like this:
www.domain.com OR domain.com goes to /web/CMS/
forum.domain.com OR forums.domain.com goes to /web/
Then any other subdomain goes to /web/CMS/ (as I'll be using the multi site network of Wordpress)
I have 2 questions:
What would be the best structure for this? Maybe I should have my CMS as root and my forum in a folder?
How can I do an htaccess that does the job? (do I also need one in /web/CMS/?)
Thank you so much in advance.
If you have vBulletin in your root and you want it to go to forums, you should consider moving it into it's own directory called /forums. Inside the /forums directory, you'll have a .htaccess file generated by vBulletin.
You can keep your WordPress inside /CMS. WordPress will and should have its own htaccess file.
Now if you want to set a subdomain, you'll have to look into your DNS settings and at a minimum setup an A record. If you're on cPanel, this is pretty simple to do inside your DNS Zone section.

Resources