i have a very simple rewrite rule, however it is not working.
i have the following:
#old see edits for newer versions
RewriteCond %{HTTP_REFERER} ^localhost:8080(/|$)
RewriteRule ^/downloads/.* /somePackage/index.php?id=5 [NC,C]
RewriteRule ^/downloads /somePackage/index.php?id=2 [NC,L]
it seems that it doesn't pass the RewriteCond
, why is this the case?
when i try this:
RewriteRule downloads/? /somePackage/index.php?id=2 [NC,L]
it seems to work for localhost:8080/downloads
but when i try:
RewriteRule downloads/.*/? /somePackage/index.php?id=5 [NC,L]
it doesn't work, why does this not work? what should i do instead?
edit:
i this is the current code which only works for localhost:8080/downloads
and localhost:8080/downloads/
but not when i add something after the slash
RewriteRule downloads/somedownload/? /somePackage/index.php?id=5 [NC,L]
RewriteRule downloads/? /somePackage/index.php?id=2 [NC,L]
edit 2:
here is the .htaccess code using for this.
# Only the URLs /downloads and /downloads/ (with and without trailing slash)
RewriteRule ^downloads/?$ /somePackage/index.php?id=2 [NC,L]
#gives 404 - Category not found
RewriteRule ^downloads/ignis_desktop$ /somePackage/index.php?id=5 [NC,L]
# Everything else that starts /downloads/<something>
RewriteRule ^downloads/. /somePackage/index.php?id=5 [NC,L]
i can't seem to find the solution to the 404.
however with [r=301]
it seems to redirect correctly to the page but it breaks the purpose of the rewrite: making the url fancy.