I've followed this: Mode Rewrite; with/without trailing slash on end of url? solution but it's not working out for my mybb site. I've tried adding it in the top and in the bottom of .htaccess ... but not working.
What could I be missing?
Here is my .htaccess, I've substitute mysite with example.com:
Options -MultiViews +FollowSymlinks -Indexes
<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off
# The below probably isn't needed, but better safe than sorry.
SecFilterScanPOST Off
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RedirectMatch 301 ^/archive/index\.php/?(.*) /$1
# Some hosts need a RewriteBase specification.
RewriteBase /
# Google SEO workaround for search.php highlights:
# Make this rule the first rewrite rule in your .htaccess!
RewriteRule ^([^&]*)&(.*)$ http://forum.example.com/$1?$2 [L,QSA,R=301]
# Google SEO Sitemap:
RewriteRule ^sitemap-([^./]+)\.xml$ misc.php?google_seo_sitemap=$1 [L,QSA,NC]
# Google SEO URL Forums:
RewriteRule ^Forum-([^./]+)$ forumdisplay.php?google_seo_forum=$1 [L,QSA,NC]
# Google SEO URL Threads:
RewriteRule ^Thread-([^./]+)$ showthread.php?google_seo_thread=$1 [L,QSA,NC]
# Google SEO URL Announcements:
RewriteRule ^Announcement-([^./]+)$ announcements.php?google_seo_announcement=$1 [L,QSA,NC]
# Google SEO URL Users:
RewriteRule ^User-([^./]+)$ member.php?action=profile&google_seo_user=$1 [L,QSA,NC]
# Google SEO URL Calendars:
RewriteRule ^Calendar-([^./]+)$ calendar.php?google_seo_calendar=$1 [L,QSA,NC]
# Google SEO URL Events:
RewriteRule ^Event-([^./]+)$ calendar.php?action=event&google_seo_event=$1 [L,QSA,NC]
# Google SEO 404:
ErrorDocument 404 /misc.php?google_seo_error=404
# Default MyBB Rewrite Rules:
RewriteRule ^forum-([0-9]+)\.html$ forumdisplay.php?fid=$1 [L,QSA]
RewriteRule ^forum-([0-9]+)-page-([0-9]+)\.html$ forumdisplay.php?fid=$1&page=$2 [L,QSA]
RewriteRule ^thread-([0-9]+)\.html$ showthread.php?tid=$1 [L,QSA]
RewriteRule ^thread-([0-9]+)-page-([0-9]+)\.html$ showthread.php?tid=$1&page=$2 [L,QSA]
RewriteRule ^thread-([0-9]+)-lastpost\.html$ showthread.php?tid=$1&action=lastpost [L,QSA]
RewriteRule ^thread-([0-9]+)-nextnewest\.html$ showthread.php?tid=$1&action=nextnewest [L,QSA]
RewriteRule ^thread-([0-9]+)-nextoldest\.html$ showthread.php?tid=$1&action=nextoldest [L,QSA]
RewriteRule ^thread-([0-9]+)-newpost\.html$ showthread.php?tid=$1&action=newpost [L,QSA]
RewriteRule ^thread-([0-9]+)-post-([0-9]+)\.html$ showthread.php?tid=$1&pid=$2 [L,QSA]
RewriteRule ^post-([0-9]+)\.html$ showthread.php?pid=$1 [L,QSA]
RewriteRule ^announcement-([0-9]+)\.html$ announcements.php?aid=$1 [L,QSA]
RewriteRule ^user-([0-9]+)\.html$ member.php?action=profile&uid=$1 [L,QSA]
RewriteRule ^calendar-([0-9]+)\.html$ calendar.php?calendar=$1 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)\.html$ calendar.php?action=yearview&calendar=$1&year=$2 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ calendar.php?calendar=$1&year=$2&month=$3 [L,QSA]
RewriteRule ^calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4 [L,QSA]
RewriteRule ^calendar-([0-9]+)-week-(n?[0-9]+)\.html$ calendar.php?action=weekview&calendar=$1&week=$2 [L,QSA]
RewriteRule ^event-([0-9]+)\.html$ calendar.php?action=event&eid=$1 [L,QSA]
<IfModule mod_env.c>
SetEnv SEO_SUPPORT 1
</IfModule>
#Added by Anurag
RewriteRule ^index\.php(.*)$ http://%{HTTP_HOST}$1 [L,R=301]
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/x-javascript text/css text/html text/xml
</IfModule>
AddType text/javascript .js
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 800000 seconds"
ExpiresByType image/jpeg "access plus 800000 seconds"
ExpiresByType image/png "access plus 800000 seconds"
ExpiresByType image/gif "access plus 800000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 800000 seconds"
ExpiresByType text/css "access plus 800000 seconds"
ExpiresByType text/javascript "access plus 800000 seconds"
ExpiresByType application/x-javascript "access plus 800000 seconds"
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\\.(ico|jpe?g|png|gif|swf|css|js)$">
Header set Cache-Control "max-age=800000, public"
</FilesMatch>
Header unset ETag
Header unset Last-Modified
</IfModule>
RewriteRule ^(.*)/$ /$1 [L,R=301]
Try adding this rule just below RewriteBase / line:
# remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} \s.+?/+[?\s]
RewriteRule ^(.+?)/$ /$1 [R=301,L,NE]
Related
In my htacess I have:
RewriteRule ^(users)/([a-z]+)$ users.php?action=$2
When I type the url : site.com/users/register/ (yes with the / at the end)
the website redirects me to : site.com/users.php/register/?action=register
What is it doing that? when it should not redirect at all.
Also, when I type the url : site.com/users/register it sends me to error page!
full code:
Header unset ETag
FileETag None
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A86400
ExpiresByType image/x-icon A2592000
ExpiresByType image/ico A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType text/css A2592000
ExpiresByType image/gif A604800
ExpiresByType image/png A604800
ExpiresByType image/jpeg A604800
ExpiresByType text/plain A604800
ExpiresByType application/x-shockwave-flash A604800
ExpiresByType video/x-flv A604800
ExpiresByType application/pdf A604800
ExpiresByType text/html A900
</IfModule>
<FilesMatch "\.(flv|gif|jpg|jpeg|png|ico|swf)$">
Header set Cache-Control "max-age=7257600"
</FilesMatch>
# 1 Week
<FilesMatch "\.(js|css|pdf|txt)$">
Header set Cache-Control "max-age=7257600"
</FilesMatch>
# 10 Minutes
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=3600"
</FilesMatch>
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
#Gzip
<ifmodule mod_deflate.c>
# compress text, HTML, JavaScript, CSS, and XML
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# remove browser bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</ifmodule>
#End Gzip
# NONE
<FilesMatch "\.(pl|php|cgi|spl)$">
Header unset Cache-Control
Header unset Expires
Header unset Last-Modified
FileETag None
Header unset Pragma
</FilesMatch>
ErrorDocument 404 http://www.site.ae
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(RSS)/([A-Z][a-zA-z0-9]+).xml$ rss.php?title=$2
RewriteRule ^(articles)/(.*)/$ article.php?s=$2
RewriteRule ^(articles)/(.*)/([0-9]+)$ article.php?s=$2&page=$3
RewriteRule ^(teams)/(.*)/$ teams.php?s=$2
RewriteRule ^(teams)/(.*)/([0-9]+)$ teams.php?s=$2&page=$3
RewriteRule ^(site)/(all)/$ site.php?s=$2
RewriteRule ^(site)/(all)/([0-9]+)$ site.php?s=$2&page=$3
RewriteRule ^(site)/(tag)/(.*)/(.*)/([A-Z]+)/([0-9]+)$ site.php?s=tag&orderby=$4&order=$5&tag=$3&page=$6
RewriteRule ^(site)/(.*)/(.*)/([A-Z]+)/([0-9]+)$ site.php?s=$2&orderby=$3&order=$4&page=$5
RewriteRule ^([A-Z][a-zA-z0-9]+)/?$ show_site.php?title=$1
RewriteRule ^([A-Z][a-zA-z0-9]+)/([0-9]+)/([0-9]+)/?$ show_chapter.php?title=$1&ch_num=$2&page=$3
RewriteRule ^([A-Z][a-zA-z0-9]+)/([0-9]+)/?$ show_chapter.php?title=$1&ch_num=$2&page=C
RewriteRule ^(t)/(.*)/$ team.php?t=$2
RewriteRule ^(t)/(.*)/([0-9]+)$ team.php?t=$2&page=$3
RewriteRule ^(contact)/?$ contact.php
RewriteRule ^(add)/(chapter)?$ addchapter.php
RewriteRule ^(add)/(site)?$ addsite.php
RewriteRule ^(add)/(info)?$ addinfo.php
RewriteRule ^(register)/?$ register.php
RewriteRule ^(user)/(.*)/$ usercp.php?page=favorite&user=$2
RewriteRule ^(my-list)/delete/([0-9]+)/$ usercp.php?page=delete&site=$2
RewriteRule ^(my-list)/add/([0-9]+)/$ usercp.php?page=add&site=$2
RewriteRule ^(review)/([A-Z][a-zA-z0-9]+)/$ addreview.php?m=$2
RewriteRule ^(users)/([a-z]+)$ users.php?action=$2
RewriteRule ^(showarticle)/([0-9]+)/$ showarticle.php?id=$2
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?siteat.com
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site.ae [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ http://i642.photobucket.com/albums/uu145/shnisaka/nohotlinking_zpsf5dd3133.jpg [NC,R,L]
RewriteCond %{HTTP_HOST} ^site.ae$
RewriteRule ^(.*)$ "http\:\/\/www\.site\.ae\/$1" [R=301,L]
More refined question:
RewriteRule ^(users)/(register)$ users.php?action=register [R=301,L]
should redirect from site.com/users.php?action=register to site.com/users/register right?
Keep your rule like this:
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?siteat\$.com
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?site\.ae$ [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ http://i642.photobucket.com/albums/uu145/shnisaka/nohotlinking_zpsf5dd3133.jpg [NC,R,L]
RewriteCond %{HTTP_HOST} ^site\.ae$
RewriteRule ^(.*)$ http://www.site.ae/$1 [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^(RSS)/([A-Z][a-zA-z0-9]+).xml$ rss.php?title=$2 [L,QSA]
RewriteRule ^(articles)/(.*)/$ article.php?s=$2 [L,QSA]
RewriteRule ^(articles)/(.*)/([0-9]+)$ article.php?s=$2&page=$3 [L,QSA]
RewriteRule ^(teams)/(.*)/$ teams.php?s=$2 [L,QSA]
RewriteRule ^(teams)/(.*)/([0-9]+)$ teams.php?s=$2&page=$3 [L,QSA]
RewriteRule ^(site)/(all)/$ site.php?s=$2 [L,QSA]
RewriteRule ^(site)/(all)/([0-9]+)$ site.php?s=$2&page=$3 [L,QSA]
RewriteRule ^(site)/(tag)/(.*)/(.*)/([A-Z]+)/([0-9]+)$ site.php?s=tag&orderby=$4&order=$5&tag=$3&page=$6 [L,QSA]
RewriteRule ^(site)/(.*)/(.*)/([A-Z]+)/([0-9]+)$ site.php?s=$2&orderby=$3&order=$4&page=$5 [L,QSA]
RewriteRule ^([A-Z][a-zA-z0-9]+)/?$ show_site.php?title=$1 [L,QSA]
RewriteRule ^([A-Z][a-zA-z0-9]+)/([0-9]+)/([0-9]+)/?$ show_chapter.php?title=$1&ch_num=$2&page=$3 [L,QSA]
RewriteRule ^([A-Z][a-zA-z0-9]+)/([0-9]+)/?$ show_chapter.php?title=$1&ch_num=$2&page=C [L,QSA]
RewriteRule ^(t)/(.*)/$ team.php?t=$2 [L,QSA]
RewriteRule ^(t)/(.*)/([0-9]+)$ team.php?t=$2&page=$3 [L,QSA]
RewriteRule ^(contact)/?$ contact.php [L,QSA]
RewriteRule ^(add)/(chapter)?$ addchapter.php [L]
RewriteRule ^(add)/(site)?$ addsite.php [L]
RewriteRule ^(add)/(info)?$ addinfo.php [L]
RewriteRule ^(register)/?$ register.php [L]
RewriteRule ^(user)/(.*)/?$ usercp.php?page=favorite&user=$2 [L,QSA]
RewriteRule ^(my-list)/delete/([0-9]+)/?$ usercp.php?page=delete&site=$2 [L,QSA]
RewriteRule ^(my-list)/add/([0-9]+)/?$ usercp.php?page=add&site=$2 [L,QSA]
RewriteRule ^(review)/([A-Z][a-zA-z0-9]+)/?$ addreview.php?m=$2 [L,QSA]
RewriteRule ^(users)/([a-z]+)/?$ users.php?action=$2 [L,QSA]
RewriteRule ^(showarticle)/([0-9]+)/?$ showarticle.php?id=$2 [L,QSA]
RewriteRule ^users/([a-z]+)/?$ users.php?action=$1
RewriteRule ^users/activate/([a-zA-Z0-9]+)/([a-z]+)/?$ users.php?action=activate&Hash=$1&UserName=$2
RewriteCond %{THE_REQUEST} users\.php
RewriteRule ^users\.php - [F]
I had to delete my .htaccess and add this to it. It worked with no problems!
I was trying to edit my htaccess file to redirect from http to https.
This one works for all pages except the homepage for every language:
http://cinqueterre.a-turist.com/deu
redirects to
https://cinqueterre.a-turist.com/https://cinqueterre.a-turist.com/deu
It's a little complicated script
Here is it:
Update: I improved a little the script, now it's not such complicated, and doesn't work if I add https redirect
DirectoryIndex 1.php index.html$ index.php
ErrorDocument 404 /404.php
RewriteEngine on
Options -Multiviews
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTPS_HOST} ^www\.cinqueterre\.a\-turist\.com$ [NC]
RewriteRule (.*) https://cinqueterre.a-turist.com/$1 [R=301,L]
RewriteCond %{HTTPS_HOST} ^cinqueterre.a-turist\.com$ [OR]
RewriteCond %{HTTPS_HOST} ^www\.cinqueterre.a-turist\.com$
RewriteRule ^(rus|ita|fra|deu|ukr|pol|esp)\/index\.php$ https\:\/\/cinqueterre.a-turist\.com\/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L,QSA]
#if its not a directory
RewriteCond %{REQUEST_FILENAME} !-d
#and it has a trailing slash then redirect to URL without slash
RewriteRule ^(.+)/$ /$1 [L,R=301]
Options All -Indexes
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
Try getting rid of all of your redirects, they're in the wrong place.
You need to add redirects before this rule:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L,QSA]
And you want something like this:
RewriteCond %{THE_REQUEST} \ /+.*index\.php
RewriteRule ^(rus/|ita/|fra/|deu/|ukr/|pol/|)index\.php$ https://cinqueterre.a-turist.com/$1 [R=301,L]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^(www\.)?cinqueterre.a-turist\.com$ [NC]
RewriteRule ^(.*)$ https://cinqueterre.a-turist.com/$1 [R=301,L]
I'm attempting to redirect an internal link via .htaccess file and it's not working. Below is my .htaccess file '# Redirects'.
How might I better structure the code to allow working redirection links?
# Use PHP 5.3
AddType application/x-httpd-php53 .php
# Redirect www to non-www
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# Redirects
Redirect 301 /oldpage http://domain/newpage
# Start Hotlink Protection
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]
# EXPIRES CACHING
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/js "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
Your redirect statement is part of mod_alias, but all the rest of the rewrite rules you have belong to mod_rewrite. Those two modules processes the request at different points of the processing pipeline, so if you use them concurrently, sometimes they'll not play nicely with each other. You should just use mod_rewrite in this case as well as putting the redirect rule BEFORE your wordpress routing rules. This is because wordpress will route what you actually want to redirect.
So:
# Use PHP 5.3
AddType application/x-httpd-php53 .php
# Redirect www to non-www
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
#### INSERT THE REDIRECTS HERE
# Redirects
RewriteRule ^oldpage(.*)$ http://domain/newpage$1 [L,R=301]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
### Remove the redirect from here
# Start Hotlink Protection
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]
And then the rest of your htaccess file
I want to know why the personal links (for url Rewriting) are not working with Prestashop...
I Did a test with (add in the end of the file):
RewriteRule ^test$ /index.php [L]
But it doesn't work. I searched on the web but I don't find something...
The default URL rewriting by Prestashop works but I can't add other links
Can you help me ? Do you need more information ?
Thanks
The htaccess file :
# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api/?(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
# Images
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^.*$ - [NC,L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType application/x-javascript "access plus 1 week"
ExpiresByType image/x-icon "access plus 1 year"
</IfModule>
FileETag INode MTime Size
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404
# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
## Ajout manuelle ##
# RewriteRule ^kit-chaine-afam.htm$ /content/6-kit-chaine-afam [L]
RewriteRule ^www.accessoires-de-la-moto.com/kit-chaine-afam.htm$ /index.php?id_cms=6&controller=cms [L]
RewriteRule ^/test$ /index.php [L]
RewriteRule ^www.accessoires-de-la-moto.com/test2$ www.accessoires-de-la-moto.com/index.php [L]
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
RewriteRule ^test3$ %{ENV:REWRITEBASE}index.php [L]
Have you tried a simple "RedirectPermanent" in your htacces file ?
RedirectPermanent /old_page_urlp /new_page_url
is it working ?
These two
RewriteRule ^www.accessoires-de-la-moto.com/kit-chaine-afam.htm$ /index.php?id_cms=6&controller=cms [L]
RewriteRule ^www.accessoires-de-la-moto.com/test2$ www.accessoires-de-la-moto.com/index.php [L]
cannot work, because the domain is not part of the URL-path pattern.
This rule should work
RewriteRule ^/test$ /index.php [L]
but this rule above from Prestashop
RewriteRule ^.*$ - [NC,L]
prevents it.
You can move your rule above the Prestashop definitions
RewriteRule ^test$ /index.php [L]
# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.accessoires-de-la-moto.com$
...
and then, the /test rule will work as expected. But be careful to not interfere with Prentashop's rules.
You just go Preferences->SEO & URLs. In the Setup URLs section, switch Friendly URLs to yes.
You can change the URL rewriting configurations and rules from the admin panel:
Preferences -> SEO & URLs -> SCHEMA OF URLS
hello this is my htaccess code
Options All -Indexes
ErrorDocument 404 /404.php
FileETag MTime Size
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /lang/
RewriteRule ^sitemap\.xml$ index.php [L]
RewriteRule ^(.*)(\.html|\.htm)$ index.php [L]
RewriteRule ^(.*)(\.rss|\.atom|\.txt)$ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php [L]
</IfModule>
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType image/gif "access plus 1 months"
ExpiresByType image/jpeg "access plus 1 months"
ExpiresByType image/png "access plus 1 months"
ExpiresByType text/css "access plus 1 months"
ExpiresByType application/x-javascript "access plus 1 months"
</IfModule>
i have this contact form
http://www.example.com/lang/contact-se
when user use the form and contact
it redirect to
http://www.example.com/lang/contact-se.html
and give me error page not found
how can i exclude this link only from rewrite and redirect to .html
Change your form to submit to /lang/contact-se instead of /lang/contact-se.html.
Not sure what this has to do with your rules, both contact-se and contact-se.html gets pointed to index.php.