Thanks to your help guys I was able to make an .htaccess that rewrites the dynamic links into static one. Now I would like to to extend that solution onto the whole site so that I load accurate module based on $_get variable. Then thanks to .htaccess I should be able to make seo friendly links. The only issue is... it's not working... It shows me an error:
403 Forbidden You don't have permission to access this document.
I am using this script to rewrite the links:
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /mod1/
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} \s/mod1/index.php\?module=([^\s&]+) [NC]
RewriteRule ^ /mod1/%1? [R=302,L]
# internal forward from pretty URL to actual one
RewriteRule ^mod1/([^\s&]+)?$ mod1/index.php?module=$1 [L,QSA]
Right now I am using the folder mod1 but normally I would like to have there a domain, so that it would have:
www.domain.com/index.php?module=create_list
to be redirected to:
www.domain.com/create_list
I have found an information on the net that I should change the permissions of the file I target (which is index in my case) to 755 but it didn't work in my case. Another mystery of that script is that the first part seems to work, but I am not sure why it always gives the url "/" at the end, even if I did not defined it in the rule.
Any help appreciated.
EDIT:
I manage to fix that problem with mall changes to the script:
Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /mod1/
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} \s/mod1/index.php\?module=([^\s&]+) [NC]
RewriteRule ^ %1.html? [R=302,L]
# internal forward from pretty URL to actual one
RewriteRule ^([^/]+).html?$ index.php?module=$1 [L,QSA]
It is working poperly. However I still do not understand few things. Firstly if I remove the # from:
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
The [L,QSA] still works but the permament [R=302,L] not, I understand that those two line are for files that are used with the php file and they fix the problem with pathways. But how to make them work together w permament redirect 302?
Second thing is I needed to add .html at the end of static link, which was not part of my plan. Is it possible to make it work without .html extension?