LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-17-2008, 10:49 PM   #1
qwqg
LQ Newbie
 
Registered: Nov 2007
Posts: 4

Rep: Reputation: 0
Rewriterule problems apache 2.2.4


Quote:
RewriteRule ^/t/([0-9]+)$ /test_push.php?test_push_id=$1
After I visit test.com/t/1, the page goto test.com/test_push.php?test_push_id=$1 ,but the RewriteRule can't do it,so please help

Last edited by qwqg; 03-18-2008 at 03:05 AM.
 
Old 03-18-2008, 02:16 AM   #2
norbert74
Member
 
Registered: Apr 2006
Posts: 63

Rep: Reputation: 23
Hi
I compared your rule with my own rules and the only thing I noticed is the leading slash. You may try this:
Code:
RewriteRule ^t/([0-9]+)$ /test_push.php?test_push_id=$1
Norbert
 
Old 03-18-2008, 02:44 AM   #3
qwqg
LQ Newbie
 
Registered: Nov 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by norbert74 View Post
Hi
I compared your rule with my own rules and the only thing I noticed is the leading slash. You may try this:
Code:
RewriteRule ^t/([0-9]+)$ /test_push.php?test_push_id=$1
Norbert
thank you!

I take out the leading slash,and test.com/t/1 display "HTTP 404 not found"
Can you paste your rewrite config file? Do you have other rule or RewriteCond?
 
Old 03-19-2008, 12:50 PM   #4
norbert74
Member
 
Registered: Apr 2006
Posts: 63

Rep: Reputation: 23
Do you also get a 404 if you directly open /test_push.php?test_push_id=$1 ? If yes, then it's not your rule, if no then please look in the apache log what file the web server tries to access.

As far as I know there is no configuration file for mod_rewrite like for mod_ssl or other modules for example. I just put all my rules in a .htaccess file, that's all.

Here is an example:

<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /

#redirect domain.com to www.domain.com
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

RewriteRule ^t/([0-9]{1})$ /test_push.php?test_push_id=$1

</IfModule>
 
Old 03-19-2008, 10:42 PM   #5
qwqg
LQ Newbie
 
Registered: Nov 2007
Posts: 4

Original Poster
Rep: Reputation: 0
thank you!

I can visit this page, http://www.test.com/w/4, but the links in it are all wrong, their url addresses all have /w, in fact the correct urls have no /w in addresses.
 
Old 03-20-2008, 12:08 PM   #6
norbert74
Member
 
Registered: Apr 2006
Posts: 63

Rep: Reputation: 23
It is not clear for me what you mean actually. If you want help, than please describe in more detail, give examples and so on.
 
Old 03-20-2008, 09:31 PM   #7
qwqg
LQ Newbie
 
Registered: Nov 2007
Posts: 4

Original Poster
Rep: Reputation: 0
I am so sorry,my mother tongue is not english,is chinese.
so my expression has some problem.

for example, the login, register,back or go home, these botton which can be clicked.

example:
login page must be http://www.test.com/login.php,but now it's change to http://www.test.com/w/login.php

register page must be http://www.test.com/register.php,but now it's change to http://www.test.com/w/register.php
 
Old 03-21-2008, 05:20 AM   #8
norbert74
Member
 
Registered: Apr 2006
Posts: 63

Rep: Reputation: 23
I personally still don't understand your scenario, maybe someone else does?
If you want contact me via ICQ (218595557) for direct communication.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache rewriterule mesh2005 Linux - Server 1 08-03-2007 03:23 AM
cleaning up apache RewriteRule entries deesto Linux - Server 0 12-12-2006 04:36 PM
Help w/ Apache htaccess (RewriteRule) bhuwan Programming 1 03-16-2006 07:06 AM
Apache ReWriteRule, ProxyPassReverse, and Allow From directives yakkerty Linux - Networking 3 06-24-2004 02:21 PM
Apache RewriteRule is driving me nuts ijsman77 Linux - Software 3 04-07-2004 03:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration