Please Help Rewrite On Nginx
`RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
#For removing extension as Options +MultiViews not working with RewriteRule RewriteRule ^([a-zA-Z0-9_]+)$ $1.php [QSA,NC,L]
RewriteRule ^profile/([a-zA-Z0-9._@-]+)$ profile.php?u=$1 [QSA,NC,L] RewriteRule ^profile/ profile.php [QSA,NC,L]
RewriteRule ^groups/([0-9]+)$ groups.php?grp=$1 [QSA,NC,L] RewriteRule ^groups/ groups.php [QSA,NC,L]
RewriteRule ^view_post/([a-zA-Z0-9]+)$ view_post.php?post=$1 [QSA,NC,L]
ErrorDocument 404 /Faiyaz/Instagram/404.php
#DirectoryIndex Options +Indexes
<FilesMatch ".(htaccess)"> order allow,deny deny from all </FilesMatch>
#Options +MultiViews
IndexIgnore * `
Have not tested this out but this should work:
location / { if (!-e $request_filename){ rewrite ^/([a-zA-Z0-9_]+)$ /$1.php last; } }
location /profile { rewrite ^/profile/([a-zA-Z0-9._@-]+)$ /profile.php?u=$1 last; rewrite ^/profile/ /profile.php last; }
location /groups { rewrite ^/groups/([0-9]+)$ /groups.php?grp=$1 last; rewrite ^/groups/ /groups.php last; }
location /view_post { rewrite ^/view_post/([a-zA-Z0-9]+)$ /view_post.php?post=$1 last; }
error_page 404 /Faiyaz/Instagram/404.php;
deny all;
location ~ .php$ { #fastcgi_pass 127.0.0.1:9000; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_split_path_info ^(.+.php)(/.+)$; try_files $uri =404; fastcgi_intercept_errors on; fastcgi_read_timeout 120; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; #fastcgi_param HTTPS on; fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice fastcgi_param front_controller_active true; fastcgi_request_buffering off; }
My Apache rewrite rules for this don't work