Forum Moderators: phranque
this is what I am trying to achieve:
[uni.ac.uk...] -> [uni.ac.uk...]
The rewrite is relatively simple and works on two servers I have tried this on except the above:
RewriteRule \.(xml¦txt¦png¦gif¦jpg¦css)$¦^index.php$ - [S=1]
RewriteRule ^([^/]+)/?$ /index.php?page=$1 [L]
However, what seems to work is:
rewriteRule ^([^/]+)/$ http://uni.ac.uk/lab/new/index.php?page=$1 [L]
Note that I have not been able to:
- exempt for xml,txt,css, etc etc files,
- use the '?' or '*' quantifier to designate the absence of a trailing slash (!)
- designate index.php as the substitution string unless preceded by the complete URL.
I do realise that the rewrite is per-directory based and that the server will have its own rules too. I now know what works and what not works but have not been able to progress from here for some days. Any help is much appreciated in this matter.
S.
On the original subject, where is this code located? Is it located in example.com/.htaccess or in example.com/lab/.htaccess?
Jim
I should be able to exempt redirects on extension as far as I know, which in my opinion is the most efficient way. Re. regular expressions, they're both practised and practiced.
Since I only have limited access to the server, I can only drop files into www.example.com/lab/ where index.php is found as well.
Options -MultiViews
#
RewriteCond $1 !\.(xml¦txt¦png¦gif¦jpg¦css)$
RewriteCond $1 !index\.php$
RewriteRule ^(([^/]+/)*[^/]+)/?$ /lab/index.php?page=$1 [L]
Replace all broken pipe "¦" characters above with solid pipe characters before use; Posting on this forum modifies the pipe characters.
If this does not help, please tell us what specific error messages you get, or any information about the server response that may be of diagnostic use; It's difficult to diagnose problems without a description of the symptoms. Also if possible, please report the contents of the server error log file when testing the code.
Jim