Current location: Hot Scripts Forums » Other Discussions » Web Servers » apache mod_rewrite for URLs without index.php


apache mod_rewrite for URLs without index.php

Reply
  #1 (permalink)  
Old 05-03-11, 07:20 AM
davidtg davidtg is offline
New Member
 
Join Date: May 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
apache mod_rewrite for URLs without index.php

Good morning!

I have numerous pages with URLs like

http://example.com/sub/dir/index.php?param=val&var=value

or even

http://example.com/sub/dir/?param=val&var=value

that I can happily rewrite as

http://example.com/sub/dir/index.php/val/value

but that's not enough :-) I would like to have the best of both and have

http://example.com/sub/dir/val/value

and have the index.php put back in for me. Another alternative is

http://example.com/sub/dir/ih/val/value

since that's still shorter. [I would use just 'i' but I may also have index.pl or index.rb and so I am defining a 2nd character for script language identification.] I am, however, being kicked in the teeth by mod_rewrite! I've written some basic tests to prove that mod_rewrite is loaded and functional, and I have been through the documentation and the tutorials and keep thinking I'm getting close, but I've gotten nowhere.

My test platform is Apache 2.2 under WAMP; my prod platform is Apache 1.3 under FreeBSD. I have access to the httpd.conf file in both cases and would like to have just a single rule or two for each index case rather than throwing .htaccess files all over the place. Can anyone give me any pointers?


TIA & HAND

:-D
--
David T-G
http://justpickone.org/davidtg/email/
Reply With Quote
  #2 (permalink)  
Old 06-15-11, 01:33 AM
getSpace getSpace is offline
New Member
 
Join Date: Jun 2011
Location: Lucknow
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up

You need to use, (.htaccess) to rewrite the SEF, Search engine friendly URLS.
an example is given below.

Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
Quote:
Originally Posted by davidtg View Post
Good morning!

I have numerous pages with URLs like

IANA — Example domains


My test platform is Apache 2.2 under WAMP; my prod platform is Apache 1.3 under FreeBSD. I have access to the httpd.conf file in both cases and would like to have just a single rule or two for each index case rather than throwing .htaccess files all over the place. Can anyone give me any pointers?


TIA & HAND

:-D
--
David T-G
David T-G's email address
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache Mobile Filter ifuschini Web Servers 0 08-15-09 06:36 PM
HUNDREDS of apache services running ?! slows server down immensley! SlaveDriver Web Servers 0 11-02-08 09:29 AM
How to connect JSP Tomcat to apache or IIS ardie_b Everything Java 1 03-09-05 06:45 PM
Apache question kjmatthews PHP 2 10-25-04 03:07 PM
php with Apache in windows eDevil PHP 3 08-08-04 12:03 AM


All times are GMT -5. The time now is 01:30 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.