Going daft, trying to do a mod rewrite in htaccess to make my dynamic links site into static, tried the various solutions here in the forums but having no luck, can anyone help, its the latest release of lsql.
Dec 8, 2004, 3:59 PM
Veteran / Moderator (6956 posts)
Dec 8, 2004, 3:59 PM
Post #2 of 5
Views: 2636
We use a very simple formula.
Our links sites are the main page of our site. (eg: home.html is our "index.html")
The key to making it work, is you need an EMPTY directory, to redirect your links from.
So, lets say you could live with the link:
http://yoursite.com/...static_category1/etc
Make an _EMPTY_ directory called "links"
Then, in the .htaccess (we do this in the server config, but it should work via .htaccess) for the root directory you put in:
RewriteEngine On
RewriteRule ^/$ /links/
RewriteRule ^/links/?$ /links/
That turns on the Rewrite engine, and defines the re-mapping relationship.
Then, in the "links" directory, you add to the .htaccess file
<Directory /path/to/links/directory/links>
Options All -Indexes -FollowSymLinks +SymLinksIfOwnerMatch
RewriteEngine On
RewriteRule (.*) /cgi-bin/LinksSQL/page.cgi?g=$1 [L]
AllowOverride All
Allow From All
</Directory>
You might have to experiment to see how you add that. I am not sure you can add that to the root .htaccess, and if you add it to the links/.htaccess file, you probably don't need the <directory> tags. (and of course change your path to the page.cgi file)
We put them in the server config, and it works. I prefer that, but if you don't have a dedicated server, you are stuck with .htaccess files.
The idea, is the .htaccess commands in the root .htaccess redirect the request to the /links directory, which takes the request, and remaps it to the RewriteRule by sending the request to page.cgi.
PUGDOG� Enterprises, Inc.
The best way to contact me is to NOT use Email.
Please leave a PM here.
Our links sites are the main page of our site. (eg: home.html is our "index.html")
The key to making it work, is you need an EMPTY directory, to redirect your links from.
So, lets say you could live with the link:
http://yoursite.com/...static_category1/etc
Make an _EMPTY_ directory called "links"
Then, in the .htaccess (we do this in the server config, but it should work via .htaccess) for the root directory you put in:
RewriteEngine On
RewriteRule ^/$ /links/
RewriteRule ^/links/?$ /links/
That turns on the Rewrite engine, and defines the re-mapping relationship.
Then, in the "links" directory, you add to the .htaccess file
<Directory /path/to/links/directory/links>
Options All -Indexes -FollowSymLinks +SymLinksIfOwnerMatch
RewriteEngine On
RewriteRule (.*) /cgi-bin/LinksSQL/page.cgi?g=$1 [L]
AllowOverride All
Allow From All
</Directory>
You might have to experiment to see how you add that. I am not sure you can add that to the root .htaccess, and if you add it to the links/.htaccess file, you probably don't need the <directory> tags. (and of course change your path to the page.cgi file)
We put them in the server config, and it works. I prefer that, but if you don't have a dedicated server, you are stuck with .htaccess files.
The idea, is the .htaccess commands in the root .htaccess redirect the request to the /links directory, which takes the request, and remaps it to the RewriteRule by sending the request to page.cgi.
PUGDOG� Enterprises, Inc.
The best way to contact me is to NOT use Email.
Please leave a PM here.
Dec 11, 2004, 12:18 PM
User (153 posts)
Dec 11, 2004, 12:18 PM
Post #3 of 5
Views: 2619
Pugdog,
I tried this on my site, and the only way I could get it to work was by removing the highlighted slash;
RewriteEngine On
RewriteRule ^/$ /links/
RewriteRule ^/links/?$ /links/
Removing the second line entirely didn't change anything but I still have problems navigating home in the menu bar link.
Any suggestions where I'm going wrong, or is this OK?
Cheers,
Piers
I tried this on my site, and the only way I could get it to work was by removing the highlighted slash;
RewriteEngine On
RewriteRule ^/$ /links/
RewriteRule ^/links/?$ /links/
Removing the second line entirely didn't change anything but I still have problems navigating home in the menu bar link.
Any suggestions where I'm going wrong, or is this OK?
Cheers,
Piers
Dec 12, 2004, 2:23 AM
Veteran / Moderator (18441 posts)
Dec 12, 2004, 2:23 AM
Post #4 of 5
Views: 2608
Try;
RewriteRule ^/?$ /links/
Hope that helps.
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
RewriteRule ^/?$ /links/
Hope that helps.
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!