I'm having trouble setting up a rewrite and hoping someone knows the answer.
This is the code that i'm currently using in .htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /point/to/dir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(\d+/.*)$ https://domain.ext/point/to/dir/module/status.php?id=$1 [L,QSA]
The client is requesting domain.ext/point/to/dir/ from the server, which should be rewritten to https://domain.ext/point/to/dir/module/status.php.
It is possible that a query is added to the end of the /point/to/dir/ request, which should be appended to https://domain.ext/point/to/dir/module/status.php. The /point/to/dir/ is a non-existing location on the server.
No matter what I do, I keep getting internal server errors (incorrect .htaccess configuration/syntax) or 404's. Hope someone can help out.
With your shown samples, have your htaccess Rules file in following manner. Make sure you change your path from point/to/dir
to your actual path(DO NOT put /
in front of it in rule else that wouldn't work).
This is assuming that your point/do/dir has module folder and index.php inside module folder too.
Make sure to clear your browser cache before testing your URLs.
Options +FollowSymLinks
RewriteEngine on
RewriteBase /point/to/dir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(point/to/dir)/(.*)/?$ https://domain.ext/$1/module/status.php?id=$2 [NC,L,QSA]
OR in case you are in same domain name then you need not to mention complete url in right part of rewriting, have it then following way, make sure either use above or following rules one at a time only.
Options +FollowSymLinks
RewriteEngine on
RewriteBase /point/to/dir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(point/to/dir)/(.*)/?$ $1/module/status.php?id=$2 [NC,L,QSA]