Solved

mod_rewrite in .htaccess

Posted on 2003-11-20
21
1,119 Views
Last Modified: 2010-03-04
I wrote this below in .htaccess file under directory /cgi-bin/AD_cla
It doesn't work with mod_rewrite. Need to do more in server?
I don't have a access to change mode in this server. And Does file .htaccess  work in directory cgi_bin?

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule cla/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/(\.*)/$ /cgi-bin/AD_cla/cla\.cgi?$1=$2&$3=$4&$5=$6&$7=$8
0
Comment
Question by:tilmes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 6
  • 6
  • +1
21 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 9789045
> And Does file .htaccess  work in directory cgi_bin?
if it is configured to do so, yes.
If it is not configured, then you're losst, means you need to do authetification in your CGI itself.
0
 

Author Comment

by:tilmes
ID: 9789333
.htaccess  file dosn't work in either in directory cgi-bin and non cgi-bin directory.
What do this file ned to be done to work properly?
I want to use mod_rewrite URL to make dynamic site spider friendly.
0
 

Author Comment

by:tilmes
ID: 9789390
Do i need also configure httpd.conf file?
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 51

Expert Comment

by:ahoffmann
ID: 9795669
> Do i need also configure httpd.conf file?
yes, you need at least:
  AllowOverride AuthConfig
in each <Directory ...> where you want .htaccess
0
 

Author Comment

by:tilmes
ID: 9795832
Could you please check two file?
It doesn't work now with those two.

### In httpd.conf
AllowOverride AuthConfig
<Directory /homepages/22/d234234/htdocs/tell/scripts/DT_php>
Options ExecCGI FollowSymLinks Includes MultiViews
</Directory>

### In .htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule detail/(\.*)/(\.*)/$ /tell/scripts/DT_php/detail\.php?$1=$2
0
 
LVL 16

Expert Comment

by:_nn_
ID: 9798008
ahoffman is 100% correct : "you need at least 'AllowOverride AuthConfig' *IN* each <Directory ...> (...)"
Moreover, you'll see at http://httpd.apache.org/docs-2.0/mod/core.html#allowoverride that this directive *cannot* be used anywhere else than within a <Directory ...> section.

So if you're going to use it, try like this :

### In httpd.conf
<Directory /homepages/22/d234234/htdocs/tell/scripts/DT_php>
Options ExecCGI FollowSymLinks Includes MultiViews
AllowOverride AuthConfig
</Directory>

Now, I see a couple other problems in your directives :

>> RewriteRule detail/(\.*)/(\.*)/$ /tell/scripts/DT_php/detail\.php?$1=$2

1. The 'left' expression : detail/(\.*)/(\.*)/$ is a regular expression.

\. => means "the dot character"
. => means "any character" (usually, but the end-of-line one)

So, your regexp will match /detail/.................../...../  (is this the URLs you want to use ?), but will fail to match anything else like /detail/xxx/yyy/ or /detail/blah/blurps/

2. The 'right' experssion is NOT a regular expression, so you don't need to 'escape' the dots.

In the end, it gives when corrected:

RewriteRule detail/(.*)/(.*)/$ /tell/scripts/DT_php/detail.php?$1=$2


Last problem is where you put the .htaccess file itself. For such a RewriteRule, it needs to be either in / or in /detail (not sure), but certainly not in the /tell/scripts/DT_php/ one.

HTH
0
 

Author Comment

by:tilmes
ID: 9798235
Thank you. I really tried a lot but it dosen't work.
The original URL is like
http://www.abcd.de/tell/scripts/DT_php/index.php?kid=12&catname=Medical+%26+Health
http://www.abcd.de/tell/scripts/DT_php/detail.php?siteid=1304

and in the .htaccess is;
Options +FollowSymLinks
RewriteEngine on

RewriteBase /
RewriteRule tell/(.*)/(.*)/$ /tell/scripts/DT_php/detail.php?$1=$2
RewriteRule tell/(.*)/(.*)/$ /tell/scripts/DT_php/index\.php?$1=$2&$3=$4

I put the httpd.conf in /
and .htaccess tried both in / and /tell/scripts/DT_php/
0
 
LVL 16

Expert Comment

by:_nn_
ID: 9798422
httpd.conf should not be copied in the DocumentRoot or in any subfolder.

In httpd.conf :

<Directory /homepages/22/d234234/htdocs/tell>
Options ExecCGI FollowSymLinks Includes MultiViews
AllowOverride All
</Directory>

In /homepages/22/d234234/htdocs/tell/.htaccess :

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^/tell/(.*)/(.*)/$ /tell/scripts/DT_php/detail.php?$1=$2 [L]

Now, please try http://www.abcd.de/tell/siteid/1034/

Btw, are you sure mod_rewrite is loaded ?
0
 

Author Comment

by:tilmes
ID: 9798633

<httpd.conf should not be copied in the DocumentRoot or in any subfolder.>
Where can i put otherwise httpd.conf? I don't have access to httpd.conf in server
because i get hosting service. I am sure they suppot rewrite mode and below is fag. from the company.
http://faq.puretec.de/skripte/php/10.html

I followed exactly yours.
I got a error 404 in
http://www.abcd.de/tell/siteid/1034/
0
 
LVL 16

Expert Comment

by:_nn_
ID: 9798728
If it's a hosting service, then you most likely don't have access to the httpd.conf file and creating one will not help at all.

Is abcd.de your domain name ? Because http://www.abcd.de/ doesn't work either, I can't even connect to the httpd daemon...
0
 

Author Comment

by:tilmes
ID: 9799330
can i make it wotj with httpd.conf?

Please look at under the address
http://www.widmen.de/jula/scripts/DT_php1
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 9799561
> I don't have access to httpd.conf in server
you're lost
the server admin must enable .htaccess for you
0
 
LVL 16

Expert Comment

by:_nn_
ID: 9799687
Is this puretec.de your hosting company ? If yes, did you simply try to follow that faq ? Something like

- no httpd.conf
- in the .htaccess file in your DocumentRoot folder :

RewriteEngine on
RewriteCond %{REQUEST_URI} tell/(.*)/(.*)/$
RewriteRule tell/(.*)/(.*)/$ /tell/scripts/DT_php/detail.php?$1=$2 [L]
0
 

Author Comment

by:tilmes
ID: 9799937
i don't know why, it doesn't work either.
0
 
LVL 16

Accepted Solution

by:
_nn_ earned 50 total points
ID: 9800367
Well then, you need to contact your hosting company to see what's going wrong here.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 9802216
hmm, isn't the graded answer not a copy of my last one?
To all your questions I suggested that you need to modify httpd.conf.

Please take care when grading.
0
 

Author Comment

by:tilmes
ID: 9802233
I am sorry if something went wrong hoffmann.
How can i modify httpd.conf.?
There are already in httpd.conf
<Directory /homepages/22/d234234/htdocs/tell>
Options ExecCGI FollowSymLinks Includes MultiViews
AllowOverride All
</Directory>
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 9802294
Please reread this thread!
You have to have admin privileges to modyfy httpd.conf (which is used by the server).
Or you need to ask the server admin (or whoever at the ISP) to do it.

Wer lesen kann, ist eindeutig im Vorteil
;-)
0
 
LVL 16

Expert Comment

by:_nn_
ID: 9802515
ahoffmann, sorry for the mess, I butted in because I noticed a couple other problems in the regexps, I of course wasn't trying to grab points.

tilmes, if contacting your hosting company helped you, then ahoffmann's comment should have been accepted as an answer, not mine. You can get a moderator to undo that acceptance, post a request in the Community Support area.

Last, I assume that this server has many websites, in which case you *CANNOT* modify the httpd.conf file yourself and creating one in your folders will *NOT* have any effect.

Das Sprichwort kannte ich nicht, ist das ein "Klassiker" (es klingt so) ? (bin selber Franzose, kann aber ein wenig deutsch)
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 9806804
I don't care about the points, just to clarify what was the most helpfull answer, at least for future readers.
(Non, ce ne pas un proverbe, est plus comme une phrase, parsque tout le mond savoir ecrivé :-))
0
 

Expert Comment

by:joesremack
ID: 25642983
I am unable to url rewritting using php smarty.
0

Featured Post

Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question