Apache : one of my RewriteRules doesn't working - apache

All of my RewriteRules runs fine except one: ^assets/(.*)$ site/assets/$1 [L]
Actually with this one I get a 404 error but my file is at the good place...
<script type="text/javascript" src="assets/js/script.js" ></script>
File in MAMP/website_name/site/assets/js/script.js
I tried different methods but nothing solve the problem.
The RewriteRule ^js/(.*) site/webroot/js/$1 [L] works well !
Here's my .htaccess
<IfModule mod_rewrite.c>
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^assets/(.*)$ site/assets/$1 [L]
RewriteRule fileXupload/server/php/$ fileXupload/server/php/index.php [L]
RewriteRule site/webroot/uploads$ http://signatix.local [R=301,L]
RewriteRule site/webroot/uploads/$ http://signatix.local [R=301,L]
RewriteRule fckeditor/(.*) externallibs/fckeditor/$1 [L]
RewriteRule ^img/(.*) site/webroot/img/$1 [L]
RewriteRule ^imgupload/(.*) site/webroot/imgupload/$1 [L]
RewriteRule ^js/(.*) site/webroot/js/$1 [L]
RewriteRule ^css/(.*) site/webroot/css/$1 [L]
RewriteRule ^upload/(.*) site/webroot/upload/$1 [L]
RewriteRule ^/img/(.*) site/webroot/img/$1 [L]
RewriteRule /upload/(.*) site/webroot/upload/$1 [L]
RewriteRule /upload.php site/upload.php [L]
RewriteRule /md5.php site/md5.php [L]
RewriteRule ^uploads/(.*) site/webroot/uploads/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)([[:punct:]]?)(.+)$ index.php?url=$1&%{QUERY_STRING} [L]
#RewriteCond %{HTTP:HTTPS} !on
#RewriteRule (.*) http://%{SERVER_NAME}/$1 [QSA,L,R=301]
</IfModule>
I'm trying to get all of my RewriteRules working.

Related

.htaccess redirection with multiple subdomain/folder

I have three folders : the base (root like www) and 2 folders :pro / perso.
I have 2 subdomains : pro.mysite.com and perso.mysite.com
I want only one .htaccess, on root and i want to create redirection for both subdomains/folders.
Like if i write mysite.com/Pro/index.php?p=cake i want to be redirected on pro.mysite.com/cake
mysite.com/Pro to pro.mysite.com is OKAY by the hosting tools.
For the pages, i have big issues. Here's my htaccess :
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteRule /?Pro/cake /Pro/index.php?p=cake [L]
RewriteRule /?Perso/kitten /Perso/index.php?p=kitten[L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ / [L,R=301]
Actually its work but... Without knowing why, it removes my "index.php", if i go on : perso.mysite.com/kitten im redirected on : perso.mysite.com/?p=kitten
Here's my actual.htaccess :
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
Rewritecond %{HTTP_HOST} !^www\.example\.com
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
RewriteRule /?Pro/revue-presse-articles-sport-coach-alsace /Pro/index.php?p=presse [L]
RewriteRule /?Pro/cachier-des-charges-sport-entreprise-coaching /Pro/index.php?p=cahierCharges [L]
RewriteRule /?Pro/offre-coaching-sport-entreprise-alsace /Pro/index.php?p=offres [L]
RewriteRule /?Pro/contact-entreprise-pro-coaching-sportif-coach-sport-alsace /Pro/index.php?p=contact [L]
RewriteRule /?Pro/temoignages-coaching-entreprise-coach-societe-sport-alsace /Pro/index.php?p=temoignages [L]
RewriteRule /?Pro/activites-sportives-entreprise-pro-coaching-sportif /Pro/index.php?p=activites [L]
RewriteRule /?Pro/coaching-sport-entreprise-pro-coach-sportif-alsace /Pro/index.php?p=presentation [L]
RewriteRule /?Particulier/coaching-activites-sportives-particuliers /Particulier/index.php?p=activites [L]
RewriteRule /?Particulier/concept-coach-coaching-individuel-collectif-domicile /Particulier/index.php?p=concept [L]
RewriteRule /?Particulier/studio-sport-sante-alsace-apas /Particulier/index.php?p=studioSante [L]
RewriteRule /?Particulier/equipe-staff-membres /Particulier/index.php?p=equipe [L]
RewriteRule /?Particulier/cachier-des-charges-sport-particuliers-domicile-coaching /Particulier/index.php?p=cahierCharges [L]
RewriteRule /?Particulier/coaching-sportif-domicile-alsace-bas-rhin-haut-rhin-strasbourg /Particulier/index.php?p=couvertureGeo [L]
RewriteRule /?Particulier/offre-coaching-sport-domicile-alsace /Particulier/index.php?p=offre [L]
RewriteRule /?Particulier/tarifs-prix-offres-coaching-sportifs-sport-alsace /Particulier/index.php?p=tarifs [L]
RewriteRule /?Particulier/contact-coaching-sportif-domicile-coach-sport-alsace /Particulier/index.php?p=contact [L]
RewriteRule /?Particulier/temoignages-coaching-domicile-coach-sport-alsace /Particulier/index.php?p=temoignages [L]
RewriteRule /?Particulier/coaching-sport-domicile-coach-sportif-alsace /Particulier/index.php?p=presentation [L]
RewriteRule /?Particulier/nos-coachs-sportifs-domicile-coach-alsace /Particulier/index.php?p=coachs [L]
ErrorDocument 404 https://www.example.com
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ / [L,R=301]
So, if we take the first one, actually if i go on : pro.example.com/revue-presse-articles-sport-coach-alsace it redirect me on pro.example.com/?p=presse
My only wish is to be redirected on :
pro.example.com/revue-presse-articles-sport-coach-alsace (without seeing the true page index.php?blabla etc)
or pro.example.com/index.php?p=presse

Priority redirecting using .htaccess

I want to set a priority in my .htaccess.
Ok, I've got folders on my root project, schema:
-root:
-core
-includes
-pages:
- profile.php
-etc
-support
-infractions
-.htaccess
and what I want to do is:
If the URL is like https://example.com/support, show the /support/index.php.
I've tried -Indexes option but it doesn't works or doesn't meet my needs.
My .htaccess is like:
Options +FollowSymlinks
Options +Indexes
Options -MultiViews
RewriteEngine On
RewriteCond %{HTTP_HOST} ^fenixcms\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://fenixcms.com/$1 [R,L]
RewriteBase /
DirectoryIndex pages/index.php
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^alert/([^/\.]+)/?$ pages/alert.php?id=$1 [L]
RewriteRule ^player/([^/\.]+)/?$ pages/profile.php?name=$1 [L]
RewriteRule ^forums/new_topic/([^/\.]+)/?$ /forums/new_topic.php?c=$1 [L]
RewriteRule ^forums/topics/([^/\.]+)/posts/edit/([^/\.]+)/?$ /forums/edit_post.php?tid=$1&pid=$2 [L]
RewriteRule ^forums/topics/([^/\.]+)/posts/new/?$ /forums/new_post.php?tid=$1 [L]
RewriteRule ^forums/topics/([^/\.]+)/posts/reply_to_id/([^/\.]+)/?$ /forums/new_quote.php?tid=$1&pid=$2 [L]
RewriteRule ^forums/topics/([^/\.]+)/edit/?$ /forums/edit_topic.php?tid=$1 [L]
RewriteRule ^forums/topics/([^/\.]+)/?$ /forums/topic.php?id=$1 [L]
RewriteRule ^forums/topics/([^/\.]+)/posts/delete/([^/\.]+)/?$ /forums/delete_post.php?tid=$1&pid=$2 [L]
RewriteRule ^forums/categories/([^/\.]+)/?$ /forums/categories.php?s=$1 [L]
RewriteRule ^forums/posts/([^/\.]+)/?$ /forums/posts.php?pid=$1 [L]
RewriteRule ^forums/([^/\.]+)/?$ /forums/$1.php [L]
RewriteRule ^revisions/([^/\.]+)/?$ pages/revisions.php?action=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)/([^/\.]+)/?$ /$1/$2.php [L]
RewriteRule ^([^\.]+)/?$ /$1/index.php [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ pages/$1.php [NC,L]

getting 500 internal server error HTACCESS

I have a website that's running this htaccess without any problem.
I have uploaded my site on my other host and Now I'm getting 500 internal server Error.
This is my htaccess :
RewriteEngine on
# Don't allow any pages to be framed - Defends against CSRF stock CSRF attacks
Header set X-Frame-Options DENY
Header set Access-Control-Allow-Origin "*"
RewriteRule ^([0-9]+)/* play.php?id=$1 [L]
RewriteRule ^pr-([0-9]+)\/.*?$ index.php?p=dis_add&id=$1 [L]
RewriteRule ^user_Account/chats/([0-9]+)$ index.php?p=fchat&id=$1
RewriteRule ^فراموشی_رمز_عبور$ index.php?p=forgetPassword
RewriteRule ^user_Account$ index.php?p=userAccount [L]
RewriteRule ^logout$ index.php?p=logout [L]
RewriteRule ^login$ index.php?p=login [L]
RewriteRule ^newAdd$ index.php?p=newAdd [L]
RewriteRule ^newAdd/([0-9]+)$ index.php?p=newAdd&catId=$1 [L]
RewriteRule ^user_Account/ea/([0-9]+)$ index.php?p=userAccount&what=editadd&id=$1
RewriteRule ^user_Account/(.*?)$ index.php?p=userAccount&what=$1 [L]
RewriteRule ^ad-([0-9]+)/.*?$ index.php?p=dis_add&id=$1 [L]
RewriteRule ^app index.php?p=info&pid=10
RewriteRule ^stores/([0-9]+)/.*? index.php?p=displayStore&Idot;=$1 [L]
RewriteRule ^page/(.*?)/.*?$ index.php?p=info&pid=$1 [L]
RewriteRule ^adds/([0-9]+)/.*?/([0-9]+)/.*?/category-([0-9]+)/.*?/subcat-([0-9]+)/.*?$ index.php?p=display_adds&cityId=$2&subCatId=$4
RewriteRule ^adds/([0-9]+)/.*?/([0-9]+)/.*?/category-([0-9]+)/.*?$ index.php?p=display_adds&cityId=$2&catId=$3
RewriteRule ^adds/([0-9]+)/.*?/([0-9]+)/.*?/subcat-([0-9]+)/.*?$ index.php?p=display_adds&cityId=$2&subCatId=$3
RewriteRule ^adds/([0-9]+)/.*?/subcat-([0-9]+)/.*?$ index.php?p=display_adds&stateId=$1&subCatId=$2
RewriteRule ^adds/category-([0-9]+)/.*?/subcat-([0-9]+)/.*?/$ index.php?p=display_adds&subCatId=$2
RewriteRule ^adds/category-([0-9]+)/.*?$ index.php?p=display_adds&catId=$1
RewriteRule ^adds/([0-9]+)/.*?/category-([0-9]+)/.*?$ index.php?p=display_adds&stateId=$1&catId=$2
RewriteRule ^adds/$ index.php?p=display_adds&all=true
RewriteRule ^adds/([0-9]+)/.*?/([0-9]+)/.*?$ index.php?p=display_adds&cityId=$2
RewriteRule ^adds/([0-9]+)/.*?/category/([0-9]+)/.*?$ index.php?p=display_adds&stateId=$1&catId=$2
RewriteRule ^adds/([0-9]+)/.*?/([0-9]+)/.*?/category/([0-9]+)/.*?$ index.php?p=display_adds&cityId=$1&catId=$2
RewriteRule ^adds/([0-9]+)/.*?$ index.php?p=display_adds&stateId=$1
RewriteRule ^blog$ index.php?p=tuts
RewriteRule ^category/([0-9]+)/.*?$ index.php?p=display_adds&catId=$1
RewriteRule ^conrimPayment$ index.php?p=conrimPayment
RewriteRule ^n([0-9]+)/.*?$ index.php?p=Disnews&id=$1 [L]
RewriteRule ^blog/([0-9]+)/.*?$ index.php?p=DisBlog&id=$1 [L]
RewriteRule ^c([0-9]+)/.*?$ index.php?p=adCat&catid=$1 [L]
RewriteRule ^category/.*?/([0-9]+) index.php?p=adCat&catid=$1
RewriteRule ^category/.*?/.*?/([0-9]+) index.php?p=adCat&catid=$1
RewriteRule ^loc/.*?/([0-9]+) index.php?p=loc&ostanId=$1
RewriteRule ^loc/.*?/.*?/([0-9]+) index.php?p=loc&cityId=$1
RewriteRule ^vije\/pr-([0-9]+)\/.*?$ index.php?p=dis_add&id=$1&sp=1&special=0 [L]
RewriteRule ^vije$ index.php?sp=1 [L]
RewriteRule ^mosabeghe\/pr-([0-9]+)$ index.php?p=dis_addMosabeghe&id=$1 [L]
RewriteRule ^ekhtesasi$ index.php?sp=1&special=1 [L]
RewriteRule ^عمومی$ index.php?p=adds&kind=omu [L]
RewriteRule ^مزایده$ index.php?p=adds&kind=moz [L]
RewriteRule ^استخدام$ index.php?p=adds&kind=est [L]
RewriteRule ^خبرها$ index.php?p=news
Options -Indexes
Why Am I getting 500 internal server error.I'm running this on my other host And it's running properly.What's wrong with this?
I just disabled saving with DOM and the problem is gone .

Apache mod_rewrite not working for apache version 2.2.31

My Apache version is 2.2.31.
Why is the following htaccess not working, but it is working in Apache version 2.4?
RewriteEngine On
Options +FollowSymLinks
Options -Indexes
Options -MultiViews
RewriteBase /
RewriteRule ^admin - [L,NC]
RewriteRule ^author - [L,NC]
RewriteRule ^install - [L,NC]
RewriteRule ^page/([^/]*)\.html$ /page.php?permalink=$1 [L]
RewriteRule ^top-phones/$ /top-phones.php [L]
RewriteRule ^phones/$ /phones.php [L]
RewriteRule ^news/$ /news.php [L]
RewriteRule ^news/([^_]*)/$ /news.php?pagenum=$1 [L]
RewriteRule ^reviews/$ /reviews.php [L]
RewriteRule ^reviews/([^_]*)/$ /reviews.php?pagenum=$1 [L]
RewriteRule ^prices/$ /prices.php [L]
RewriteRule ^prices/([^_]*)/$ /prices.php?pagenum=$1 [L]
RewriteRule ^contact/$ /contact.php [L]
RewriteRule ^compare/$ /compare.php [L]
RewriteRule ^compare/([^_]*)/([^_]*)\.html$ /compare-result.php?first=$1&second=$2 [L]
RewriteRule ^([^/]*)/$ /brand.php?brand=$1 [L]
RewriteRule ^([^/]*)/([^_]*)/$ /brand.php?brand=$1&pagenum=$2
RewriteRule ^reviews/([^_]*)_([^_]*)\.html$ /review-details.php?review_permalink=$1&review_id=$2 [L]
RewriteRule ^reviews/([^_]*)_([^_]*)/([^_]*)/$ /review-page-details.php?review_permalink=$1&review_id=$2&page_permalink=$3 [L]
RewriteRule ^news/([^_]*)_([^_]*)\.html$ /news-details.php?news_permalink=$1&news_id=$2 [L]
RewriteRule ^tag/([^_]*)\.html$ /search.php?search=$1 [L]
RewriteRule ^devices/([^_]*)/([0-9]+)\.html$ /devices.php?permalink=$1&pagenum=$2 [L]
RewriteRule ^devices/([^_]*)\.html$ /devices.php?permalink=$1 [L]
RewriteRule ^([^/]*)/([^_]*)\.html$ /phone-details.php?brand_permalink=$1&phone_permalink=$2 [L]
ErrorDocument 404 /index.php
Order Deny,Allow
Deny from 76.164.234.170
Deny from 27.159.235.19
Deny from 76.164.228.218

Merge two .htaccess codes

I have two .htaccess , the fist .htaccess locate in the root directory which is www folder and the 2nd .htaccess locate in folder called forum
the .htaccess codes in www folder cannot work with the .htaccess codes in the forum folder
what i am working on is how to merge both htaccess to be in the root directory www
.htaccess in the www directory
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.site\.com$
RewriteRule ^/?$ "http\:\/\/www\.site\.net\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^(?:www\.)?site\.com$ [NC]
RewriteRule ^(.*)$ http://www.site.net/$1 [R=301,L]
.htaccess in the forum directory
#RewriteEngine On
RewriteRule ^site-t(.*).html showthread.php?t=$1 [L]
RewriteRule ^site-f(.*) forumdisplay.php?f=$1 [L]
RewriteRule ^f(.*)-(.*).html forumdisplay.php?f=$1 [L]
RewriteRule ^site-u(.*).html member.php?u=$1 [L]
RewriteRule ^index.php$ http://%{http_host}/ [R=301,L
RewriteRule ^t(.*).html showthread.php?t=$1 [L]
RewriteRule ^f(.*).html forumdisplay.php?f=$1 [L]
RewriteRule ^post(.*)-(.*) showpost.php?p=$1&postcount=$2 [L]
RewriteRule ^u(.*).html member.php?u=$1 [L]
RewriteRule archive/t-(.*) archive/index.php/t-$1 [L]
RewriteRule tags/(.*).html tags.php?tag=$1 [L]
RewriteEngine on
# This file is only needed if you have set the Forum Component URL in your admincp and you are
# using the mod_rewrite option for friendly urls. If this is the case, copy this file
# to your forum component stub directory.
# If you are having problems or are using VirtualDocumentRoot, uncomment this line and set it to your forum component directory.
# RewriteBase /forum-stub-directory/
# If you are having problems with the rewrite from content/ to content.php, uncomment this line to turn MultiViews off.
# Options -MultiViews
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# Forum
RewriteRule ^threads/.* showthread.php [QSA]
RewriteRule ^forums/.* forumdisplay.php [QSA]
RewriteRule ^members/.* member.php [QSA]
##################################################
RewriteEngine on
RewriteRule ^f.txt vbmaps.php?cat=d [L]
RewriteRule ^t([0-9]+).txt vbmaps.php?rss=d&page=$1 [L]
RewriteRule ^tag([0-9]+).txt maptag.php?rss=d&page=$1 [L]
RewriteRule ^t([0-9]+).txt vbmaps.php?rss=d&page=$1 [L]
RewriteRule ^tag([0-9]+).txt maptag.php?rss=d&page=$1 [L]
RewriteRule ^forums maps.php?cat=d [L]
RewriteRule ^thread([0-9]+) maps.php?rss=d&page=$1 [L]
RewriteRule ^forums.xml maps.php?cat=d
RewriteRule ^thread([0-9]+).xml maps.php?rss=d&page=$1 [L]
RewriteRule ^t([0-9]+)\-([0-9]+)\.html$ showthread.php?t=$1&page=$2 [L]
RewriteRule ^f([0-9]+)\-([0-9]+)\.html$ forumdisplay.php?f=$1&page=$2 [L]
RewriteRule ^post([0-9]+)\.html$ showthread.php?p=$1#post$2 [L]
RewriteRule ^t(.*).html showthread.php?t=$1 [L]
RewriteRule ^u(.*).html member.php?u=$1 [L]
RewriteRule ^f(.*).html forumdisplay.php?f=$1 [L]
RewriteRule ^f(.*)-t(.*) showthread.php?t=$1 [L]
RewriteRule ^t([0-9]+)\-([0-9]+)$ showthread.php?t=$1&page=$2 [L]
RewriteRule ^f([0-9]+)\-([0-9]+)$ forumdisplay.php?f=$1&page=$2 [L]
RewriteRule ^post([0-9]+)$ showthread.php?p=$1#post$2 [L]
RewriteRule ^t([0-9]+)$ showthread.php?t=$1 [L]
RewriteRule ^u([0-9]+)$ member.php?u=$1 [L]
RewriteRule ^f([0-9]+)$ forumdisplay.php?f=$1 [L]
RewriteRule ^t([0-9]+)\-([0-9]+)$ showthread.php?t=$1&page=$2 [L]
RewriteRule ^f([0-9]+)\-([0-9]+)$ forumdisplay.php?f=$1&page=$2 [L]
RewriteRule ^post([0-9]+)$ showthread.php?p=$1#post$2 [L]
RewriteRule ^t([0-9]+)$ showthread.php?t=$1 [L]
RewriteRule ^u([0-9]+)$ member.php?u=$1 [L]
RewriteRule ^f([0-9]+)$ forumdisplay.php?f=$1 [L]
RewriteEngine On
RewriteRule ^t(.*).html showthread.php?t=$1 [L]
RewriteRule ^f(.*).html forumdisplay.php?f=$1 [L]
RewriteRule ^u(.*).html member.php?u=$1 [L]
RewriteRule ^(.*)-post(.*).html showpost.php?p=$1&postcount=$2 [L]
RedirectMatch 301 thread(.*).html$ http://www.site.net/vb/showthread.php?t=$1
#########################################################
RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbulletin_sitemap_index.xml.gz [L]