Newbe - mod_rewrite -> redirect to index.php in a subfolder
Newbe - mod_rewrite -> redirect to index.php in a subfolder
am 20.04.2008 20:47:01 von Snaggy
here's my problem: I want to have everything redirected to index.php
but for images and javascript. The point is that I'm in a subfolder of
the web server:
http://localhost/mySite/home --> http://localhost/mySite/index.php/home
(rewritten)
http://localhost/mySite/script.js --> http://localhost/mySite/script.js
(not affected)
http://localhost/otherSite/home --> http://localhost/otherSite/home
(not affected)
any help would be appreciated!
thanks
Snaggy
Re: Newbe - mod_rewrite -> redirect to index.php in a subfolder
am 20.04.2008 21:12:03 von HansH
"Snaggy" schreef in bericht
news:d07dda87-608a-4e9d-b7a0-4664566e8342@f63g2000hsf.google groups.com...
> here's my problem: I want to have everything redirected to index.php
> but for images and javascript. The point is that I'm in a subfolder of
> the web server:
>
> http://localhost/mySite/home --> http://localhost/mySite/index.php/home
> (rewritten)
>
> http://localhost/mySite/script.js --> http://localhost/mySite/script.js
> (not affected)
>
> http://localhost/otherSite/home --> http://localhost/otherSite/home
> (not affected)
>
Find below some untested lines to be put in .../mySite/.htaccess
RewriteEngine on
RewriteCond %{REQUEST_URI} ! \.(js|css|[jm]pe?g|gif|png|tiff?|ico)$
RewriteRule (.*) index.php/$1 [L]
Selecting what has to be passed to the script might be more fail safe:
RewriteEngine on
RewriteRule (.*\.(html?|css))$ index.php/$1 [L]
HansH
Re: Newbe - mod_rewrite -> redirect to index.php in a subfolder
am 22.04.2008 16:26:30 von drhowarddrfine
>
> Find below some untested lines to be put in .../mySite/.htaccess
> RewriteEngine on
> RewriteCond %{REQUEST_URI} ! \.(js|css|[jm]pe?g|gif|png|tiff?|ico)$
> RewriteRule (.*) index.php/$1 [L]
>
> Selecting what has to be passed to the script might be more fail safe:
> RewriteEngine on
> RewriteRule (.*\.(html?|css))$ index.php/$1 [L]
>
> HansH
I'm trying to do the same thing. I entered that but get a server
error of "bad flag delimiters".
Re: Newbe - mod_rewrite -> redirect to index.php in a subfolder
am 22.04.2008 18:48:49 von HansH
"drhowarddrfine" schreef in bericht
news:bd623a2d-e731-4fe8-862d-4c1000cf3549@e67g2000hsa.google groups.com...
>> Find below some untested lines to be put in .../mySite/.htaccess
>> RewriteEngine on
>> RewriteCond %{REQUEST_URI} ! \.(js|css|[jm]pe?g|gif|png|tiff?|ico)$
>> RewriteRule (.*) index.php/$1 [L]
>>
>> Selecting what has to be passed to the script might be more fail safe:
>> RewriteEngine on
>> RewriteRule (.*\.(html?|css))$ index.php/$1 [L]
>>
> I'm trying to do the same thing. I entered that but get a server
> error of "bad flag delimiters".
>
Did you create the file on Windows and uploaded it to *nix?
Than check if line endingsare converted by the FTP tool used.
HansH
Re: Newbe - mod_rewrite -> redirect to index.php in a subfolder
am 22.04.2008 18:57:25 von drhowarddrfine
On Apr 22, 11:48 am, "HansH" wrote:
> "drhowarddrfine" schreef in berichtnews:bd623a2d-e731-4fe8-862d-4c1000cf3549@e67g2000hsa .googlegroups.com...>> Find below some untested lines to be put in .../mySite/.htaccess
> >> RewriteEngine on
> >> RewriteCond %{REQUEST_URI} ! \.(js|css|[jm]pe?g|gif|png|tiff?|ico)$
> >> RewriteRule (.*) index.php/$1 [L]
>
> >> Selecting what has to be passed to the script might be more fail safe:
> >> RewriteEngine on
> >> RewriteRule (.*\.(html?|css))$ index.php/$1 [L]
>
> > I'm trying to do the same thing. I entered that but get a server
> > error of "bad flag delimiters".
>
> Did you create the file on Windows and uploaded it to *nix?
> Than check if line endingsare converted by the FTP tool used.
>
> HansH
No, created on Unix/FreeBSD, then uploaded.
Re: Newbe - mod_rewrite -> redirect to index.php in a subfolder
am 22.04.2008 19:24:50 von HansH
"drhowarddrfine" schreef in bericht
news:2b3254ad-fe92-4122-8279-3c68b51915c5@l42g2000hsc.google groups.com...
> On Apr 22, 11:48 am, "HansH" wrote:
>> "drhowarddrfine" schreef in
>> berichtnews:bd623a2d-e731-4fe8-862d-4c1000cf3549@e67g2000hsa .googlegroups.com...>>
>> Find below some untested lines to be put in .../mySite/.htaccess
>> >> RewriteEngine on
>> >> RewriteCond %{REQUEST_URI} ! \.(js|css|[jm]pe?g|gif|png|tiff?|ico)$
>> >> RewriteRule (.*) index.php/$1 [L]
>>
>> >> Selecting what has to be passed to the script might be more fail safe:
>> >> RewriteEngine on
>> >> RewriteRule (.*\.(html?|css))$ index.php/$1 [L]
>>
>> > I'm trying to do the same thing. I entered that but get a server
>> > error of "bad flag delimiters".
>>
>> Did you create the file on Windows and uploaded it to *nix?
>> Than check if line endingsare converted by the FTP tool used.
>>
> No, created on Unix/FreeBSD, then uploaded.
>
Show a copy of the lines and the complete error logged.
HansH
Re: Newbe - mod_rewrite -> redirect to index.php in a subfolder
am 22.04.2008 19:29:59 von Snaggy
using this:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^\.(js|css|[jm]pe?g|gif|png|tiff?|ico)$
RewriteRule (.*) index.php/$1 [L]
I get this error:
"Request exceeded the limit of 10 internal redirects due to probable
configuration error"
it's like it is looping, since the rewritten url is stil passible of
rewriting. How can I tell him not to rewrite it again? Maybe adding as
a condition the absence of "index.php" ?? How to do that?
thanks
Snaggy
Re: Newbe - mod_rewrite -> redirect to index.php in a subfolder
am 22.04.2008 21:01:47 von drhowarddrfine
Don't want to hijack Snaggy's thread. I'll start my own.
Re: Newbe - mod_rewrite -> redirect to index.php in a subfolder
am 22.04.2008 21:22:54 von HansH
"Snaggy" schreef in bericht
news:5160588d-81c4-4650-999f-40e86268543b@2g2000hsn.googlegr oups.com...
> RewriteEngine on
> RewriteCond %{REQUEST_URI} !^\.(js|css|[jm]pe?g|gif|png|tiff?|ico)$
> RewriteRule (.*) index.php/$1 [L]
>
> I get this error:
> "Request exceeded the limit of 10 internal redirects due to probable
> configuration error"
>
> it's like it is looping, since the rewritten url is stil passible of
> rewriting. How can I tell him not to rewrite it again? Maybe adding as
> a condition the absence of "index.php" ?? How to do that?
>
Did not expect a loop, since not redirecting, just rewriting ...
.... must be an internal subrequest introduced via .htaccess.
Try
RewriteRule (.*) index.php/$1 [L,NS]
HansH