Forum Moderators: phranque
# Allow Properly formatted URL to access content
RewriteRule ^([a-z0-9]{5})/([a-z0-9]*)/?$ ./php/content.php [NC,L]
# Correct Improperly formatted URL and allow access to content
ReWriteRule ^([a-z0-9]+)/?$ 10000/$1 [NC]
RewriteCond %{REQUEST_URI} ^10000/([A-Za-z0-9]+)$
RewriteRule (.*) ./php/content.php [NC,L]
I would like the improperly formatted request to show the numeric "10000" in the URL bar in the users browser. This does not achieve that goal. Is it possible?
Thanks.
So
RewriteRule (.*) /php/content.php [NC,L]
RewriteRule (.*) [b]http:[i][/i]//www.example.com[/b]/php/content.php [NC,[b]R=301[/b],L]
Jim
To recap, my .htaccess contains ...
# Allow Properly formatted URL to access content
RewriteRule ^([a-z0-9]{5})/([a-z0-9]*)/?$ ./php/content.php [NC,L]
# Correct Improperly formatted URL and allow access to content
ReWriteRule ^([a-z0-9]+)/?$ 10000/$1 [NC]
RewriteCond %{REQUEST_URI} ^10000/([A-Za-z0-9]+)$
RewriteRule (.*) ./php/content.php [NC,L]
While this sequence flows smoothly, I would like it when my visitor types [mydomain.com...] that it appear in the URL as [mydomain...] when the page is loaded, however it stays the same.
I would also like to maintain session info. In prior testing, using [mydomain.com......] started a new session.
Also, it appears that on my server the leading dot on the redirect target is necessary as the starting point (representing the current diretory) to direct the path up to the correct directory and the document.
Any other suggestions?
Many thanks.
# Allow Certain Perl Scripts to run
RewriteRule ^cgi-bin/y/d.cgi/?([a-z]+)-IPP([0-9]+)$ - [NC,L]
# Allow Properly formatted URL to access content
RewriteRule ^([a-z0-9]{5})/([a-z0-9]+)/?$ ./php/content.php [NC,L]
# Allow Improperly formatted URL to access content and assign default PERL_SCRIPT_NUM
ReWriteRule ^([a-z0-9]+)/?$ [mydomain.com...] [NC,R=301,L]
It dawned on me that the $_SESSION variable I was declaring and using was set on the first page the visitor arrived at, and since there would be no more redirects (only rewrites), the variable would survive.
Thanks for your help.
PS - Don't know what was happening to cause the Internal Server Error when I used the redirect before. Maybe something in the rule?
As for the 500-Server Error, I don't know. You can always put the old (bad) code back on the server and test it, then check the server error log to see what problem it caused. ;)
Jim