homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Mod-rewrite and .htaccess question

 8:30 pm on Jun 20, 2003 (gmt 0)

What is the code to put in .htaccess to get


to show up as


With or with out .html at the very end.

The best I can get it right now is

RewriteEngine On
RewriteBase /cgi-local/directory/
RewriteRule ^file_name.html$ file_name.cgi





 9:02 pm on Jun 20, 2003 (gmt 0)


When processing a server-internal rewrite, mod_rewrite changes a requested URL into a pathname for use within the server, before your script runs.

I suspect you are trying to make your URLs more search-engine friendly. If that is the case, then it is up to your script to output search-engine friendly URLs, and you would then use mod_rewrite to translate those URLs -- when requested by the client (browser or SE 'bot) -- back into the "unfriendly" form that you need to call your script.

In case you're doing something different, here's an example for one of the rewrites you asked for:

name.cgi?item=number&type=Search -> name/item/number/type/Search

RewriteCond %{QUERY_STRING} ^([^=]+)=([^&]+)&([^=]+)=(.+)$
RewriteRule ^name\.cgi$ /name/%1/%2/%3/%4 [L]

Ref: Introduction to mod_rewrite [webmasterworld.com]



 9:29 pm on Jun 20, 2003 (gmt 0)

Is there a different permission setting when you do mod-rewrite? When I get an error message, this is what it gives out. (The normal script URL works fine.)


CGIWrap encountered an error while attempting to execute this script:

Error Message: Permission denied
Error Number: 13

This message usually indicates there is a problem with the script
itself. Often this indicates either that the #! line of the script is
incorrect, or the script was uploaded in binary mode instead of ascii
mode. Check to make sure that the script does not have control-M's at
the end of every line. That will prevent it from executing. An easy
fix that takes care of this most of the time is to put '#!/.../perl
--' instead of '#!/.../perl' on the first line of the script. This is
typically a problem if the script was edited or uploaded from a
DOS/Windows/Macintosh station to a unix based server.

If you are not the owner of this script, please forward this error and
the URL that caused it to the script owner. That is often the
component in the URL right after /cgiwrap/.


 3:24 am on Jun 21, 2003 (gmt 0)

Can't edit......

I got it working!

RewriteEngine on
RewriteBase /cgi-local/directory/
RewriteRule ^store\-mode\-(.*)\-id\-(.*).html$ store.cgi?mode=$1&id=$2
RewriteRule ^store\-mode\-(.*).html$ store.cgi?mode=$1
RewriteRule ^store\-item\-(.*)\-type\-Search.html$ store.cgi?item=$1&type=Search

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved