Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please Help Rewrite On Nginx #60

Open
onlinesnic opened this issue Apr 28, 2018 · 2 comments
Open

Please Help Rewrite On Nginx #60

onlinesnic opened this issue Apr 28, 2018 · 2 comments

Comments

@onlinesnic
Copy link

`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

#Options +MultiViews

IndexIgnore *
`

@patriclougheed
Copy link

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;
}

@homemadestea58
Copy link

My Apache rewrite rules for this don't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants