After enabling SEO URLs in OpenCart admin panel, all the links return 404 - not found.
My .htaccess file
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
The site is located in /var/www/html/opencurt, I am trying to change to RewriteBase /opencurt, but it doesn't help me. I also cleared my cache.
The current URL on my local machine is http://127.0.0.1/
I know it's common problem, but I can't resolve it by myself.
Firs of all - take default .htaccess.txt file form your versions OpenCart pakage.
Now, you have to rename .htaccess.txt into .htaccess. It's not so easy on Windows. Open it with notepad and then Save As the file, renaming it to .htaccess without .txt.
Although, make sure that you are using Apache webserver, because only
If you are using address like this http://127.0.0.1/ - your rewrite base is RewriteBase /.
In SEO URL you should use only Latin symbols, digits, minus(-) and underscore (_). No spaces or other special characters.
UPDATED
There is SEO field in every category, product, manufacturer. You should fill SEO field of each of them to SEO URL (or better SEO PRO) works correct.
UPDATED 2
If apache doesn't see .htaccess file - you should go to apache .conf file and add after VirtualHost block
<Directory /var/www/html/your_folder/>
Options Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Directory - is a path from your virtual server root. Restart apache. Should work.
Related
I was trying to add SSL to a WP site that lives in a subdomain using this tutorial: https://www.youtube.com/watch?v=GPcznB74GPs .
All was working well and the site was responding to HTTPS until I edited the .htaccess file to try to force all traffic to SSL. Now I get "The requested URL / was not found on this server." on all domains (there are other sub domains that are siblings of the one I was editing and they are broken too).
After editing the .htaccess file and seeing the site was broken, I put the .htaccess file back the way it was but now it's still broken. I edited 2 files trying to fix this (public_html/.htaccess and public_html/mysubdomain.com/.htaccess) but have reverted each back to their original contents. Still no love.
The public_html/.htaccess is this:
# 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
#begin brad changes
php_value max_input_vars 3000
#end brad changes
and the public_html/mysubdomain.com/.htaccess file is this
# Switch rewrite engine off in case this was installed under HostPay.
RewriteEngine Off
SetEnv DEFAULT_PHP_VERSION 53
# 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
They are so plain vanilla I don't understand what could be going wrong.
Note that sibling sites (public_html/myOtherSite.com/) are also broken but i've not changed anything in those folders. This leads me to believe the main .htaccess file is messed up somehow.
I edited the files using GoDaddy's CPanel editor which asked me before opening the files if UTF8 was OK. Should that matter?
It turns out this was user error. Apparently CPanel support drag/drop and I inadvertently dragged my public_html folder under public_ftp so all my files were "gone". When I put the public_html back, everything started working again.
I've just read so much about this issue, but I'm lost here. Can't make this s*$%& work. Here's the issue. Graphic designer has a working WordPress, of which I know same as nothing, about some kindergarten in the city. She builds a landing page to throw a marketing campaign within a subfolder landing201812 inside the public_html folder of the hosting space. The WordPress is installed/deployed/whatever at the root of the site.
Site: https://www.newmills.com.ar/
Landing: https://www.newmills.com.ar/landing201812/
Directories:
public_html/
- lots_of_wordpress_rubbish
- .htaccess
- landing201812/
- sendform.php
Reading about wordpress bootstrapping way for processing all the requests, I have altered the .htaccess file in public_html so it excludes the rewriting of wordpress and goes straight to the landing site.
Original content:
# 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
Actual content
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^landing201812/?.* - [L] # My added rule
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
With both configurations, the static content (html/css/media) is served correctly, but, any php I would like to execute within that landing201812 folder, fails with a 404 Not Found error. I have tried also to exclude any landing201812 route with RewriteCond directives from the last RewriteRule like
RewriteCond %{REQUEST_URI} !.*landing201812.*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
But the results are the same.
I am quite limited to move around the wordpress since I know nothing about wordpress. I have considered moving it to a subfolder of the public_html, but I'm afraid of breaking it, or its URLs. I have tried to disable the permalinks, but there's no On/Off switch that I could find.
Last, but in case you may wonder, I have tried including another .htaccess file inside my landing201812 folder. RewriteEngine Off did not work as much as the alternative I took from a native wordpress subfolder:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /landing201812/
RewriteRule ^.*\.php$ - [L]
</IfModule>
# END WordPress
So... does anyone know what's wrong, or even better, how to fix this issue? Everyone says on the web that I should be fine with the htaccess rule, or disabling the permalinks, or moving the wordpress to a subfolder and not the root folder. Moving it is the last thing I would like to do, because I won't know how to fix it if it breaks. Am I missing something? Is there any log I should check?
Thanks in advance for any help.
if you are using cpanel, this is not necessary to do in .htaccess
Instead, can you please keep the original wordpress .htaccess and just assign permissions with filezilla to 775 to the folder?
Also, there should be a configuration missmatch, please try re-loading the PHP version in CPANEL (with PHP MANAGER) only to that folder.
If you can provide access to the site in private, maybe I can give you a hand.
It seems to me that if you were to keep the origional WordPress .htaccess and change your file structure to the following it will work at /landing201812/:
public_html/
- lots_of_wordpress_rubbish (not my opinion, just here to match OP)
- .htaccess
- landing201812/
- index.php
The key is naming the file index.php. Otherwise, you can call the file by name like so: /landing201812/sendform.php.
Sorry if this a duplicate question, but I'm not sure how to solve this issue.
Currently I have a wordpress site in /var/www/html directory.
This wordpress site is integrated with the Pydio System (Secure File Sharing for business), just like a subdomain. Both systems are linked with a plugin called ajaxplorer.
The Pydio system is in /var/www/html/pydio directory. So, this one is like a subdirectory for wordpress site.
All works fine when I navigate into http://mysite.example/pydio... But using the pydio system, if I navigate to some url like: http://mysite.example/pydio/ws-inbox/ and then, I then refresh the page, it redirects to the wordpress site again, but the URL stills the same: http://mysite.example/pydio/ws-inbox/, showing a wordpress 404 page error. (as when you are looking for a post)... so I need navigate again to http://mysite.example/pydio/ in order to access the pydio system again.
What I want is that when I refresh the url: http://mysite.example/pydio/ws-inbox/, it remains in the same Pydio system, and do not redirect to wordpress.
I have been searching about and trying to create a .htaccess, (because my WP directory do not have an .htaccess before) but without success.
Instead, Pydio folder has the following .htaccess:
<IfModule mod_rewrite.c>
# You must set the correct values here if you want
# to enable webDAV sharing. The values assume that your
# Pydio installation is at http://yourdomain/
# and that you want the webDAV shares to be accessible via
# http://yourdomain/shares/repository_id/
RewriteEngine on
RewriteBase /dms
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^shares ./dav.php [L]
RewriteRule ^api ./rest.php [L]
RewriteRule ^ocs/ ./opencollab.php [L]
RewriteRule ^ocs-provider/ ./opencollab.php [L]
RewriteRule ^user ./index.php?get_action=user_access_point [L]
RewriteCond %{REQUEST_URI} !^/pydio/index
RewriteCond %{REQUEST_URI} !^/pydio/plugins
RewriteCond %{REQUEST_URI} ^/pydio/dashboard|^/pydio/settings|^/pydio/welcome|^/pydio/ws-
RewriteRule (.*) index.php [L]
#Following lines seem to be necessary if PHP is working
#with apache as CGI or FCGI. Just remove the #
#See http://doc.tiki.org/WebDAV#Note_about_Apache_with_PHP_as_fcgi_or_cgi
#RewriteCond %{HTTP:Authorization} ^(.*)
#RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
#Following lines may be necessary for a PHP-FPM setup
# to make sure that authorization is transmitted.
# Just remove the # at the beginning of the line
#SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</IfModule>
AddType application/json .json
So, maybe someone knows how could I fix this issue?
Thanks in advance!
I am working for someone who runs a webshop. Now the webshop runs on Opencart software, and fortunately they support SEO Url rewriting. I have been trying to get this working for the last 2 hours and havent been able to get it right. I have done the following to the .htaccess file.
# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
# 2. In your opencart directory rename htaccess.txt to .htaccess.
# For any support issues please visit: http://www.opencart.com
Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes
# Prevent Direct Access to files
<FilesMatch ".(tpl|ini|log)">
Order deny,allow
Deny from all
</FilesMatch>
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /opencart/
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Additionally i have enabled SEO rewriting on opencart and given all products/categories etc. a SEO name.
Now the .htaccess file is located in: public_html/opencart/ so i have changed the RewriteBase from / to /opencart/
Still i get the following errors:
Not Found
The requested URL /aquaria/adm-aquaria was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Does anyone have a solution for me?
To give you an example i want the following link: http://aquadeco.eu/index.php?route=product/category&path=94_291 to look like this: http://aquadeco.eu/aquaria/adm-aquaria
You don't have to put this
RewriteBase /opencart/
If your url are like this yourDomain.com/opencart/index.... Then
you will have to put RewriteBase /opencart/
end if; :)
with your url you don't have to put RewriteBase /opencart/
only /
Regards
Ok, wow i just found out i have been stupid the whole time. I had 2 .htaccess files. One which was the original without the right rewrite rules and 1 in my /opencart/ folder which had the right rewrite rules. What i did now is put the right rewrite rules into the .htaccess file in my root folder and it fixed the problem!! :D
You put your site in sub directory so you have to make following changes
RewriteBase /opencart/ change to RewriteBase /
and
RewriteRule ^([^?]*) index.php?route=$1 [L,QSA] change to
RewriteRule ^([^?]*) /opencart/index.php?route=$1 [L,QSA]
Okay, I've got a working wp installation (www.SITEURL1.co.uk) at the root of SERVER1 and I want to move another wordpress (www.SITEURL2.co.uk) I have in another server (SERVER2), in a subfolder of (www.SITEURL1.co.uk/onlinerevision) right now like this:
ROOT(siteurl1)
wp-admin
wp-content etc.
(SITEURL1/onlinerevision/)
wp-admin
wp-content etc..
So I put the 2nd wp installation files into the given (www.SITEURL1.co.uk/onlinerevision/) subfolder. Now I can see the homepage is accessible, the css is not okay and also all the links are redirecting to the www.SITEURL2.co.uk
e.g: www.SITEURL1.co.uk/onlinerevision/login/ is redirected to www.SITEURL1.co.uk/login/ or
www.SITEURL1.co.uk/onlinerevision/signup/ is redirected to www.SITEURL1.co.uk/signup/
Also www.SITEURL1.co.uk/onlinerevision/wp-login.php is looping in a redirect to the same page (www.SITEURL1.co.uk/onlinerevision/wp-login.php) and I can't login to dashboard like this:
http://siteurl1.co.uk/onlinerevision/wp-login.php?redirect_to=http%3A%2F%2Fsiteurl1.co.uk%2Fonlinerevision%2Fwp-admin%2F&reauth=1
In the database I opened for www.SITEURL1.co.uk/onlinerevision/, I'm changing the wp_options table -> siteurl from www.SITEURL2.co.uk/ to www.SITEURL1.co.uk/onlinerevision/
but somehow it's turning back to www.SITEURL2.co.uk/
Apparently www.SITEURL1.co.uk and www.SITEURL1.co.uk/onlinerevision/ both have the same htaccess codes:
# 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 tried different methods but didn't work. Any help would be really appreciated!
Thanks for your time.
Sorry got side tracked again.
First, lets address the .htaccess files.
In the root you want to tell it to ignore your second WordPress installation directory.
/.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# Skip your second WordPress installation
RewriteCond %{REQUEST_URI} !^/(onlinerevision|onlinerevision/.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
For the second installation you want to set the RewriteBase then tweak the final rule so it uses it properly.
onlinerevision/.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
# Set the RewriteBase to this directory
RewriteBase /onlinerevision/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Remove the slash before index.php or we end up at root
RewriteRule . index.php [L]
</IfModule>
# END WordPress
Second, there are two places you need to change the site URL when you move a WordPress installation. They are both located in the wp_options table. One is named siteurl and the other is named home.
I yanked a copy of one of my test sites and moved it to a directory in another test site then set those two .htaccess files and was golden. Most other oddities in a move are related to plugins/themes or URLs embedded in pages/posts. If you still have issues try disabling all themes/plugins to see if it clears up.
Debugging mod_rewrite
Also, you can turn on logging for mod_rewrite to help narrow it down. The log can be cryptic but once you figure out how to read it you can usually pick out what is going wrong or at least narrow it down. To do that you need to add a couple lines to the server conf (not htaccess file). A good place is the VirtualHost directive for the site you are having trouble with...
RewriteEngine On
RewriteLog "/var/log/httpd/rewrite.log"
# From 0 (no logging) to 9 (OMFG make it stop)
RewriteLogLevel 3
PS: Logging over 2-3 has a significant impact on your server so only use it when debugging and don't forget to turn it off when done.