0

I've ask this rewrite rule for Everything but certain pattern question.

Well, the problem is still the same. I have the following htaccess:

<IfModule mod_rewrite.c>
    # Options +FollowSymLinks -Indexes
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_URI} "forum/" [OR]
    RewriteCond %{REQUEST_URI} "forum"
    RewriteRule (.*) $1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteCond %{REQUEST_URI} !^/forum
    RewriteRule (?!^forum(?:/.*|)$)^(.*)$ /index.php/$1 [L,NC,QSA]
</IfModule>

And this directory structure:

public_html
 |--- /forum
 |--- /assets
 |--- /application
 |--- /system
 |--- index.php
 |--- .htaccess

forum subdirectory has Simple Machine Forum installed, while the root directory has CodeIgniter installed.

Basically, I want if someone accessing http://getnocms.com/something, it will be rewritten into http://getnocms.com/index.php/something.

But, if someone accessing http://getnocms.com/forum, I don't want any rewrite rule applied.

Well, it actually work. But the strange phenomenon happens when I try to access: http://www.getnocms.com/forum/index.php?action=admin;area=manageboards;sa=newcat;feb4219=bea74b1ac6aace220b204cb50a5d5027 This way, the CodeIgniter seems to take over and show 404 not found page. However if I edit the address bar into this: http://www.getnocms.com/forum/index.php?action=admin&area=manageboards&sa=newcat&feb4219=bea74b1ac6aace220b204cb50a5d5027 It run correctly (the smf handle the request)

I come into sudden conclusion that rewriteCond doesn't work with semicolon. Is that right?

Community
  • 1
  • 1
goFrendiAsgard
  • 4,016
  • 8
  • 38
  • 64
  • semi colon shouldn't create any problem. Can you pls try `[L,NC,NE]` flags instead of `[L,NC,QSA]` in your RewriteRule line. – anubhava May 19 '13 at 05:47
  • Still has no luck with that – goFrendiAsgard May 19 '13 at 06:07
  • You are preventing rewrites of forum-urls in 3 locations. That a bit of overkill :-). Try changing the first block to just `RewriteRule ^forum - [L]` (so without the rewriteConds) – Gerben May 19 '13 at 11:56
  • @goFrendiAsgard: I suspect something outside this .htaccess is causing this. Can you just rename this .htaccess and then try above forum URI with semicolon to see how it behaves? – anubhava May 19 '13 at 13:20
  • Gerben: Yes, a bit overkill :p @anubhava: I've try that, and the server give me 403 Forbidden You don't have permission to access /forum/index.php on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. – goFrendiAsgard May 20 '13 at 03:32
  • That is so strange, if .htaccess goes away then where is 403 coming from. Can you check if there is a .htaccess file just under `forum/` subdir?` – anubhava May 20 '13 at 04:35
  • Hi, @anubhava, thank you for all of your help. Yes, there is a `.htaccess` inside `/forum` folder. But I don't think there is something suspicious about it. You can check it here: https://gist.github.com/goFrendiAsgard/5610634 – goFrendiAsgard May 20 '13 at 06:00
  • That is true your attached forum/.htaccess looks alright. smf should still work without DOCUMENT_ROOT/.htaccess but you're strangely getting 403. If you can **[enable Rewrite Log](http://stackoverflow.com/questions/286004/hidden-features-of-mod-rewrite)** then you can get better debug information. – anubhava May 20 '13 at 11:45
  • Unfortunately I don't have the access. However I can still access the page by replace `;` with `&`. So I think I'll give up with this :p Thanks for your kind help – goFrendiAsgard May 22 '13 at 02:26
  • This [answer](http://stackoverflow.com/questions/1178024/can-a-url-contain-a-semi-colon) could provide some insights to your problem. – Erenor Paz Mar 19 '14 at 18:17

0 Answers0