My .htaccess on localhost XAMPP works fine;
RewriteEngine on
RewriteBase /
Options +FollowSymLinks
Options -MultiViews
Options -Indexes
DirectorySlash Off
RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
RewriteRule .* ? [F,L]
RewriteCond %{DOCUMENT_ROOT}/templates/$1\.tpl -f
RewriteRule ^([\w\-.\s]+)$ index.php?page=$1 [QSA,NC,L]
ErrorDocument 404 /sources/404.php
When I move it to GoDaddy host, when I'm trying to go site.com/Downloads I'm getting error 404 which doesn't happen on XAMPP.
What did I do wrong?
Related
Can someone help me with this one please?
We have a XCart site running version 1.19.2.1 and we would like to force all traffic to HTTPS. The SSL certificate is installed and the .htaccess file looks like this:
DirectoryIndex home.php index.php index.html index.htm
# ErrorDocument 404 /404.php
# Show default error document for 404 errors caused by opening of image/media files.
<Files ~ "\.(gif|jpe?g|png|js|css|swf|ico)$">
ErrorDocument 404 default
ErrorDocument 401 default
# Clean URLs [[[
Options +FollowSymLinks -MultiViews -Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(ww+\.)?domain\.com
RewriteRule ^(.*) http://www.domain.co.uk/$1 [R=301,L]
<IfModule mod_rewrite.c>
RewriteCond %{ENV:REDIRECT_STATUS} !^401$
RewriteCond %{REQUEST_URI} !^/(payment|admin|provider|partner)/
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ dispatcher.php [L]
</IfModule>
# /Clean URLs ]]]
RewriteEngine on
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php56” package as the default “PHP” programming language.
<IfModule mime_module>
AddType application/x-httpd-ea-php56 .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
I have tried editing the file to redirect all traffic to HTTPS, I get a too many redirects error.
One example that I tried was replacing the entire contents of the .htaccess file with:
ErrorDocument 404 /index.php
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
rewritecond %{http_host} ^domain.co.uk [nc]
rewriterule ^(.*)$ https://www.domain.co.uk/$1 [r=301,nc]
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.domain.co.uk/$1 [R=301,L]
# RewriteRule ^([a-zA-Z0-9\-\%\s\_\.]+)(.htm)$ index.php?page=$1 [L]
##RewriteRule ^([a-zA-Z0-9\-\%\s\_\.]+)\.htm$ index.php?page=$1 [L]
DirectoryIndex index.php
#DirectoryIndex site_closed.html
RewriteEngine on
The above works fine on another XCart site but not this one. Again, I get the too many redirects error.
Anybody have any idea how I can fix it?
Kind regards
James
I had edited the htaccess file but I hadn't edited the https.php file as described here: https://help.x-cart.com/index.php?title=X-Cart:Configuring_HTTPS#Configure_the_HTTPS_server_in_X-Cart
All working now.
This is the rewrite rule does not working in .htaccess:
RewriteCond %{REQUEST_URI} ^/magento/resultados-busqueda/
RewriteRule resultados-busqueda/(.*) /magento/index.php/catalogsearch/result/$1 [L,QSA,NC]
If I add [R] flag, it's work fine, but without [R] does not work.
Please help!!
Sorry for my english.
Thank you!
It turns out that the new Apache version has changed in some way, if you are using apache 2.4, I suggest you to change your etc/apache2/apache2.conf file (you'll need root permission) as follows:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Then restart apache.
sudo service apache2 restart
It works ;)
Use below .htaccess snippet in your $DOCUMENT_ROOT/magento/.htaccess:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /magento
RewriteRule ^resultados-busqueda/([^/]+)/?$ /magento/index.php/catalogsearch/result/?q=$1 [QSA,P,NC]
URI domain/magento/resultados-busqueda/pantalones and show error 404.
This my .htaccess:
<IfModule mod_rewrite.c>
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /magento
RewriteRule ^api/rest api.php?type=rest [QSA,L]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^resultados-busqueda/(.*)$ /magento/index.php/catalogsearch/result/?q=$1 [L,NC]
RewriteRule .* index.php [L]
I have the following .htaccess file
Options +FollowSymLinks
RewriteEngine On
Options -Indexes
RewriteRule ^index/?$ index1.php [NC]
RewriteRule ^index/(.*\.html)/?$ index1.php?load=$1 [NC,L]
RewriteRule ^page/?$ page.php [NC]
RewriteRule ^page/([0-9]+)/([a-z]+)/([{a-z}{0-9}{\-\}]+)/?$ page.php?id=$1&cat=$2&title=$3 [NC,L]
and its work perfectly in my localhost. but not works in server,
the following .htaccess works good in my server
RewriteEngine on
RewriteRule testpage\.html http://www.google.com [R]
did i make any mistake? any help?
I have a mod rewrite working on localhost, but not in godaddy shared host.
Options -Multiviews
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/WebShop/View/public%{REQUEST_URI} -f
RewriteRule ^(.*)$ WebShop/View/public/$1 [L]
RewriteRule ^(.*)$ entryPoint.php [QSA,L]
The problem is with the RewriteCond part. It cannot find the exsiting files in the subfolder. I tried with absolute path, relative path, rewritebase everything, but neither of them worked. Godaddy doesn't grant access to the rewritelog... Any idea how to solve this problem?
Edit:
The htaccess is in a subfolder, and in the document root is a htaccess which splits the request by domain into subfolders:
Options -Multiviews
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ([^\.]+\.[^\.]+)$
RewriteRule ^(.*)$ %1/$1 [L,QSA]
And the real problem is, that the %{REQUEST_URI} in the htaccess of the subfolder contains the name of the subfolder too :S
Edit2:
Ok I have a partial solution:
Options -Multiviews
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/([^/]+)/(.*)$
RewriteCond %{DOCUMENT_ROOT}/%1/WebShop/View/public/%2 -f
RewriteRule ^(.*)$ entryPoint.php?file=%2 [L]
RewriteRule ^(.*)$ entryPoint.php [QSA,L]
This prints the file name if exists, but it's kind of joke, cause if I change the second rule to
RewriteRule ^(.*)$ x.php [QSA,L]
Then everything goes to the x.php. I'm wondering why mod rewrite never recognize the L flag?
(go drink a beer)
It's maybe because of some sort of strange directory settings, but if you redirect to a subDirectory on a godaddy server, you have to create there an empty .htaccess file with RewriteEngine On, otherwise it won't work.
The preceding code in the edit2 section works well, but not on a godaddy server... Here is the file access version of it:
Options -Multiviews
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/([^/]+)/(.*)$
RewriteCond %{DOCUMENT_ROOT}/%1/WebShop/View/public/%2 -f
RewriteRule ^(.*)$ WebShop/View/public/%2 [L]
RewriteRule ^(.*)$ entryPoint.php [QSA,L]
And I placed an empty .htaccess file with RewriteEngine On in the "WebShop/View/public" directory, that fixed the L flag problem.
I am trying to redirect my site from non-www to www. My site is at [http://www.alennuskoodit.us]. I try to make it so that all requests without www would be redirected to www. Normal stuff so far.
However, if I go to http://alennuskoodit.us I end up here: http://www.alennuskoodit.us/index.php?qstr=http://www.alennuskoodit.us
This is the .htaccess:
Options +FollowSymLinks
Options +Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
# going to install folder
RewriteCond %{REQUEST_URI} (.*)/install/?$
RewriteRule ^(.*)$ %1/install/index.php [NE,R,L]
# going to Admin folder
RewriteCond %{REQUEST_URI} (.*)/admin/?$
RewriteRule ^(.*)$ %1/Admin/index.php [NE,R,L]
# working with client side
RewriteRule ^(.*)/$ index.php?qstr=$1 [L]
</IfModule>
This is what I tried, which doesn't work:
RewriteCond %{HTTP_HOST} ^alennuskoodit.us [NC]
RewriteRule ^(.*)$ http://www.alennuskoodit.us/$1 [R=301,NC,L]
How could I redirect all queries to http://alennuskoodit.us to http://www.alennuskoodit.us so that I would not end up breaking the other rewrites?
Place your new rule before all the other rules i.e
Options +FollowSymLinks
Options +Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{HTTP_HOST} ^alennuskoodit.us$ [NC]
RewriteRule ^(.*)$ http://www.alennuskoodit.us/$1 [R=301,NC,L]
#other rules here
and it should prevent the qstr= param
Step1= You Must Use This Code In htaccess File To Preferred www Version:
RewriteCond %{HTTP_HOST} !^(.).YourDomain.com$ [NC] RewriteRule ^(.)$ http://www.YourDomain.com/$1 [R=301,L]
Step2= You Must Setting Your Preferred Domain In Google WebMaster Tools :
Open up your webmaster tools and click “Settings” right below “Configuration”. To the right look for the “Preferred Domain” and select which domain you prefer With www Or Not.