Question
.htaccess to nginx rewrite rules i need help for that
Can you help me with that rules? I try to implememnt but i take a lot of mistakes and too many redirects, so i want little help with that.
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
ErrorDocument 404 https://follow.bgsources/not-found.php
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[\s?] [NC]
RewriteRule ^ /%1 [R=302,NE,L]
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*)index\.php$ /$1 [L,R=302,NC,NE]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^hashtag/([^/]+)/?$ hashtags.php?tag=$1 [L,QSA]
RewriteRule ^settings/([\w-]+)/?$ settings.php?set=$1 [L,QSA]
RewriteRule ^credit/([\w-]+)/?$ buyCredit.php?cr=$1 [L,QSA]
RewriteRule ^status/([^/]+)/?$ status.php?msgID=$1 [L,QSA]
RewriteRule ^chat/([\w-]+)/?$ chat.php?with=$1 [L,QSA]
RewriteRule ^account/([\w-]+)/?$ sources/index.php?get=$1 [L,QSA]
RewriteRule ^dashboard/([\w-]+)/?$ admin/index.php?set=$1 [L,QSA]
RewriteRule ^profile/([^/]+)/?$ profile.php?username=$1 [L,QSA,NC]
RewriteRule ^profile/(followers|friends|saved|stories)/([^/]+)/?$ $1.php?username=$2 [L,QSA,NC]
RewriteRule ^mymarket/([^/]+)/?$ market.php?marketid=$1 [L,QSA,NC]
RewriteRule ^mymarket/(sold|about)/([^/]+)/?$ market.php?marketid=$2 [L,QSA,NC]
RewriteRule ^event/([^/]+)/?$ event.php?eventID=$1 [L,QSA,NC]
RewriteRule ^events/([\w-]+)/?$ events.php?p=$1 [L,QSA,NC]
RewriteRule ^product/([^/]+)/?$ product.php?productid=$1 [L,QSA]
RewriteRule ^marketplace/(category)/([^/]+)/?$ marketplace.php?category=$2 [L,QSA,NC]
RewriteRule ^marketplace/(search)/([^/]+)/?$ marketplace.php?sproduct=$2 [L,QSA,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin '*'
</IfModule>
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×