Forum Moderators: phranque
I have been trying to use mod_rewrite in the .htaccess file to make dynamic pages be static pages, I have only been able to get the base page to load, and can't get the other pages to load.
What I would like to get it to do is make requests to
[mydomain.com...] read
[mydomain.com...] and I have got that to
work a few times, however once I add more to the path such as
[mydomain.com...] or
[mydomain.com...] it
won't work.
Here is code simlar to what I have been using in the htaccess file, I am not
sure what I am doing wrong.
RewriteEngine On
RewriteBase /exec/store/
RewriteRule ^(.*)? /~totalmar/cgi-bin/cart.cgi/$1/$2
RedirectMatch ^$ /exec/store/$1/$2
I have tried reading the Apache guides at:
[httpd.apache.org...]
[httpd.apache.org...]
Only I am having problems still, I have tried to get this to work but can't get it to work. How can I fix it?
You might want to check out this post [webmasterworld.com] for some ideas.
I would recommend that your check to make sure you don't need to enable SymLinks, and make sure that you really need the RewriteBase directive. Examining your raw error log and looking at the rewritten file path is often useful in this regard.
If the above does not help, please post a more detailed description of what works, what doesn't work, and how it is malfunctioning.
Jim
<added>Also, several of your backreferences are undefined. i.e. $1 and $2 in the target URL are defined by the first and second parenthesized groups in the rewrite pattern. Your first rule is missing a definition for $2, and both $1 and $2 are undefined in your second rule. HTH.</added>
RewriteEngine on
RewriteBase /
RewriteRule ^$ ~userbob/cgi-bin/cart.cgi/ [R]
I tried creating a symlink, but it won't work as the ~userbob/ is the name of the catalog, if I use a symlink it doesn't appear to know where to find the catalog and won't work.
Any ideas? Thanks
This combines the two functions - redirecting your site index page "/" to /~userbob/cgi-bin/cart.cgi/, and redirecting non-blank pathnames from /exec/store/whatever to /totalmar/cgi-bin/cart.cgi/whatever
RewriteEngine on
RewriteBase /
RewriteRule ^$ ~userbob/cgi-bin/cart.cgi/ [R,L]
RewriteRule ^exec/store/(.*)$ ~totalmar/cgi-bin/cart.cgi/$1 [R,L]
HTH,
Jim