LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   apache rewrite rule (https://www.linuxquestions.org/questions/linux-newbie-8/apache-rewrite-rule-912994/)

sunlinux 11-11-2011 06:20 AM

apache rewrite rule
 
I have a rule:

RewriteRule ^/a/(book)(.*) /c/d/en/a/$1/$2 [L,PT]

if i type

url www.url/a/book/faq.html it goes to www.url/a/book/

if i type www.url/a/book//faq.html it works and loads source page

why so ?

lithos 11-11-2011 11:54 AM

I'm sorry but I don't have any idea what you're trying to do with rewrite.

Can you explain yourself what you're trying to do, then help may come.

sunlinux 11-11-2011 10:44 PM

here is more clarity .... for rewrite rule

source:
wwwsite/a/book/faq.html

destination:
wwwsite/d/en/a/book/faq.html

rule i placed:

RewriteRule ^/a/(book)(.*) /d/en/a/$1/$2 [L,PT]

if i type in browser

wwwsite/a/book/faq.html it goes to wwwsite/a/book/ (with no page found 404 error)

if i typein browser: wwwsite/a/book//faq.html it works and loads destination page (wwwsite/d/en/a/book/faq.html)

why does it working placing // double slashes ?

sunlinux 11-14-2011 12:36 AM

its closed space between $1/S2

lithos 11-14-2011 06:27 AM

probably if you leave out the $2 to read:
Code:

RewriteRule ^/a/(book)(.*) /d/en/a/$1 [L,PT]
it may work

I don't know really.

good luck...

catkin 11-14-2011 07:06 AM

Is your RewriteRule within a Directory block?


All times are GMT -5. The time now is 01:20 PM.