I have magento hosted on nginx.I have installed wordpress in magento roor directory.
I have my blog url like www.mymagento.com/blog and blog post urls are like www.mymagento.com/blog/page/2/.
The blogpost urls pages are working fine. But when I go to www.mymagento.com/blog.
The page structure is messed up.
If I enable Use Web Server Rewrites to no in magento admin, everything workes well.
This is www.mymagento.com dummy url.
How can I fix this issue please help.
Add following code in .htaccess of www.mymagento.com/blog, clean browser history and try again:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /shop/index.php [L]
</IfModule>
Hope that will help you!
Related
I have Magento 2 and want to setup WordPress in a subfolder, so it will be accessed via magento2.url/blog
I know about Fishpig but for my situation, it will not work because WordPress site has a lot of custom post types which is not supported by FishPig integration by default.
Right now if I tried to access magento2.url/blog it shows a 404 error Magento 2 page.
I modified .htaccess in WordPress subfolder to this:
# 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
But it not helps and home page for WordPress still shows a 404 Magento 2 page. I think I need to modify .htaccess in Magento 2 but not really sure how.
The .htaccess is irrelevant when integrating WordPress into Magento. This file only applies when accessing WordPress directly (ie. for a WordPress Admin request).
Here are basic installation instructions:
Install WordPress in a sub-directory of Magento called wp.
If you use the pub directory to display Magento, either install WordPress at pub/wp or create a symlink at pub/wp to point to the actual wp folder.
Check the wp_options table for the home and siteurl values. The siteurl value should be the /wp URL and the home option should be your /blog URL
This is all you need to do to integrate WordPress at /blog.
The .htaccess file has no impact here, however you should change /blog/ to /wp/ in the .htaccess for WordPress. The correct value is:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
</IfModule>
# END WordPress
For a full installation guide, see this link.
For case if using Apache.
install Magento
install Wordpress to subfolder blog
add to .htaccess & pud/.htaccess following code
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
In folder pub create symbol link like
ln -s /var/html/blog /var/html/pub/blog
As answered on https://magento.stackexchange.com/a/53757 you should install WordPress outside the Magento directory.
Despite of that, in your case you must edit Magento .htaccess because WP can't be accessed wich explains the Magento 404 error.
RewriteRule ^/blog/(.*) /blog/$1 [QSA]
I'm a new user and frankly, I haven't got a clue what I'm doing at this point. I'm figuring things out slowly but surely and this site has so far been a gold mine for me... So, let's see if we can make this work.
So, my website has a WordPress installation within the root directory to allow me to have a blog; WordPress is installed solely for the blog and this is in the public_html/wp folder. Everything within the wp folder is WordPress.
Now, when I write a post, the permalink is my-website.co.uk/wp/post-title.
The .htaccess file rewrites this permalink to my-website.co.uk/blog/post-title.
This is great, looks much better but the problem is, when WordPress auto-shares the posts, the /wp/post-title permalink redirects to homepage and not to the relevant blog post. This means, whenever someone clicks on the shared link, they're taken to my homepage (sorry if I sound like I'm dumbing it down).
Now, in the public_html folder, I have one .htaccess file which is as follows
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^(.+?)/do-not-touch.php do-not-touch.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.htm -f
RewriteRule ^(.+?)/?$ $1.htm [L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule .*[^/]$ $0/ [L,R=301]
RewriteRule ^blog/([0-9-]+)/?$ blog.php?page=$1
RewriteRule ^blog/([A-Za-z0-9-]+)/?$ blog.php?slug=$1
RedirectMatch 301 ^/tenants.htm /information-for-tenants.htm
Then, in the WP folder, we have another .htaccess file:
#+PHPVersion
#="php70"
AddHandler x-httpd-php70 .php
#-PHPVersion
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
</IfModule>
# END WordPress
My theory (remember, I have no idea what I'm doing) is that the second .htaccess file redirects the /wp/ permalinks up to the public_html file index (shown by the RewriteBase /wp/ RewriteRule ^index\.php$ --- Not sure what the \.php$ does) whilst the first .htaccess file rewrites the /wp/post-title to /blog/post-title (shown by RewriteRule ^blog/([0-9-]+)/?$ blog.php?page=$1 and RewriteRule ^blog/([A-Za-z0-9-]+)/?$ blog.php?slug=$1).
Finally, in my WordPress admin permalink settings, the selected permalink is shown as my-website.co.uk/wp/sample-post/.
All permalinks are my-website.co.uk/wp/[customisable] -- In other words, it doesn't allow me to alter the /wp/ section of the permalink.
I could really use some help. I need to redirect wp/post-title (whatever the title may be) to blog/post-title instead of /index.
As a result of the redirect, search engines fail to crawl my blog posts (I think?).
This is my website blog: https://www.harryalbertgroup.co.uk/blog
And this is the WP permalink: https://www.harryalbertgroup.co.uk/wp
Thanks in advance.
(Note: This website was built for me. I've been slowly fixing all of the issues I've faced so far. We're slowly getting there, it's really just the sharing features that I need to fix now, from what I can see)
I'm a noob with wordpress and I'm creating a website with it. The thing is I've changed the permalinks to be the name of the entry/page. I've created 2 pages so far, and when I view my website and click on the links to those pages, the url does change to wordpress/page1 or wordpress/page2, but the page shown is always the main page.
I'm working with wamp for windows, so I've been doing some research. This is what I've found so far:
My .htaccess is like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
I've also changed the mod_rewrite inside apache httpd.conf removing the # and I've saved changes in permalinks. Nothing is working.
I guess you have to make a change in your .htaccess file from:
RewriteBase /
to the following:
RewriteBase /wordpress/
Fixed.
It was not recognizing my single.php
I have a php based site with wordpress installed in a subdirectory.
The main php site has urls in the following form
http://www.smokescreencreative.co.uk/nameofpage
which are rewritten using htaccess so they actually access pages like so:
http://www.smokescreencreative.co.uk/index.php?pid=$1
This all works as needed. My problem is with the /blog subdirectory. When in the blog part of the site trying to click on a link back to the main part of the site actually directs to
http://www.smokescreencreative.co.uk/blog/nameofpage
instead of
http://www.smokescreencreative.co.uk/nameofpage
as required and I am getting a 404 error because there is nothing there. I think this must be down to my htaccess files but I can't work out how to make it so the links to the main php page take the form I want but the blog post etc stay in the /blog/nameofpage format.
I did manage to get it so /blog/nameofpage was bringing in the correct written content for the root pages but there was no styling or images and the url was still /blog/nameofpage and I would like it to be just /nameofpage if possible.
I've posted the htaccess code for the root directory and blog subdirectories below. any help with this would be much appreciated.
Thanks in advance
main root htaccess code: (works for the links in the root part of the site)
AddType application/x-httpd-php .php .html .htm
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /index.php?pid=$1 [L]
htaccess code for the wordpress subdirectory
# 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
I am setting up a website inside a wordpress installation folder.
So it's like:
http://mysite.com/newsite/
Primarily, http://mysite.com is a wordpress installation, now I want to set up another site*(not a wordpress website)* on that directory which is newsite,
So basically it looks like this mysite/newsite/
When I go to that link, it changes the URL and leads me to a page of mysite page. I think maybe because of the .htaccess of the wordpress installation.
How can I access on my newly setup website without being redirecting me to http://mysite.com page?
PS:
Wordpress .htaccess configuration:
# 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
Your help will be appreciated!