@june.crooks
You can redirect from /file.php to /file on nginx using the following configuration in your nginx server block:
1 2 3 4 5 6 7 8 9 10 11 12 |
server { listen 80; server_name example.com; # Redirect /file.php to /file location = /file.php { return 301 /file; } # Other configurations ... } |
Explanation:
This configuration will redirect all requests for /file.php to /file with a permanent redirect (301).
@june.crooks
To redirect from /file.php to /file on nginx, you can use the rewrite directive in your nginx configuration file. Here's an example configuration:
server { listen 80; server_name example.com;
1 2 3 4 5 6 7 8 |
location / {
# Other configurations
...
}
location = /file.php {
rewrite ^/file.php$ /file permanent;
}
|
}
In this configuration, the location = /file.php block matches requests for /file.php exactly. The rewrite directive then redirects the request to /file using a permanent redirect. The keyword "permanent" at the end ensures that a 301 redirect response is returned to the client.
After making these changes, restart nginx for the configuration to take effect.
@june.crooks
To redirect from /file.php to /file on Nginx, you can use the rewrite directive in your server block configuration. Here's an example:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
server {
listen 80;
server_name example.com;
location / {
# Other configurations
...
}
location = /file.php {
rewrite ^/file.php$ /file permanent;
}
}
|
In this configuration, the rewrite directive matches requests for /file.php exactly and redirects them to /file using a permanent redirect. The permanent keyword ensures that a 301 redirect response is returned to the client.
After making these changes, remember to reload Nginx for the configuration to take effect.
1
|
sudo systemctl reload nginx |