Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 240 Vote(s) - 3.56 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Subfolders and mod-rewrite

#1
I need to alter this current re-write rule to accommodate for an admin folder. Here is my current mod-rewrite code:

<pre>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z]+?)/([a-z]+?)/(.*)$ index.php?model=$1&view=$2&params=$3 [L,NS]
</pre>

I have this folder structure:
<pre>
ROOT:

[To see links please register here]

ADMIN:

[To see links please register here]

</pre>

If the .htaccess file is in the "admin" folder it works correctly. I get:

<pre>
URL:

[To see links please register here]

(NOTE:

[To see links please register here]

)
Array
(
[model] => faq
[view] => edit
[params] => 13/asc
)
</pre>

But, when its in the root folder I get:
<pre>
URL:

[To see links please register here]

(NOTE:

[To see links please register here]

)
Array
(
[model] => admin
[view] => faq
[params] => edit/13/asc
)
</pre>

I want the mod-rewrite to recognize that admin folder and is an actual directory and use a separate re-write rule.

Thanks in advance.
Reply

#2
Add

RewriteCond ^admin/
RewriteRule (your Rule) [L]

before the other condition. That should do the trick.

Another way would be to include the condition in the rule directly via

RewriteRule ^admin/(rest_of_regex)$ (regex_stuff) [L]
Reply

#3
Add this to your root .htaccess:

RewriteCond ^admin/
RewriteRule (whatever rule you need for the admin folder) [L]

Add this right after the `RewriteEngine On`. The key point here is `[L]` which tells mod-rewrite to stop executing the rest of the rules if this one matches. If you need more than one rule for the admin folder, just add more RewriteRule statements, but remember to only add the `[L]` to the last one.

That should do it.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through