Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

mod_rewrite in .htaccess

Posted on 2003-11-20
21
Medium Priority
?
1,134 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
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses
Course of the Month11 days, 1 hour left to enroll

571 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