-
I understand a bit and i have a couple of questions. :D
1.) RewriteBase is in my htaccess on "/" and not for a dir. I've read about it and know i can specify some folders.
But how can i have more RewriteBase like this(?):
RewriteBase /
RewriteBase /funny_stuff
RewriteBase /more_dirs
1. a) Or is this for a htaccess per directory? Because i have only one global working htaccess (except sub-domains/wildcards)
2.) {REQUEST_URI}, for what is this?
3.) Why only [L] and not [R]? I thought R is redirect and with NC non case sensitiv.
4.) {QUERY_STRING}, and what for is this? *lol*
I read so much about this but i can't (don't ?) understand what that do, like request_uri.
A few questions for now and if i can understand this, the massive "episodes" rules are history.
I hope! :D
Thank you very much! (again^^)
-
1) I believe you only use one rewrite base for each .htaccess file. To create different events, you will use different rules and conditions. The base is only to determine the most basic path from which the rest is determined: If you use a base of "/folder1" then the path "/folder2" will be using "/folder1/folder2". Almost always, it makes sense to use "/" as the base because it is standard. Then you can write anything you want as a path in a rule or a condition.
1a) You can use .htaccess files in different folders, but this is for a different reason: the most local (closest) .htaccess file is the most important. Your main .htaccess file works for the whole site, then any .htaccess file in a folder works only in that folder and in subfolders. You can do this for anything you want.
2) In .htaccess files, the special terms in {} are information on the server. There are a lot of different terms, but REQUEST_URI is the full request URL from the user. If they want your page about Germany, it will be: "/germany/index.html".
3) There are many options. [L] means last rule-- if this matches, it stops here. [R] means redirect, and this happens in the browser. mod_rewrite doesn't do a redirect: it does a hidden "rewrite" so that the browser sees a different page, but it sees it from the same URL it requested. Does that make sense? Redirects and mod_rewrite do very different things, and it's important to know which you want.
4) Same as (2), but the "query string" is the part of the URL after the "?". For example: mypage.php?myvariable=myvalue--- the "query string" is: "myvariable=myvalue".
-
Thank you very much for this detailed information!!!
So i think in my case it's ok with my rules. Because i use pretty "old" links (oldschool) without php and id's. I think about to change this for many times and everytime i said to: what for?
As you could see, my Homepage is pretty small but with many videos/contents. And i think it is too much work for all if i do like in your tutorial.
Well, yes, i understand now what is meant with request_uri and so on. Like you said before it is only for if i make appropriate links in the .php file.
And thats the point. ;)
I think, after reading at all, i decide to "i let it be right now as is" and well, you could also see, the links in my flash-cartoons section working really good with your help.
I don't know why i can't use stressed (Unterstrich => _ ) in my "first" rule like "flash_cartoons" and i don't know, how i should set a [L] (if neccessary).
But i can live with this. You know how i mean?
I am glad to have made it all possible with your help and mmhyeah, one questione left. ;)
Why i have to use this: ^(flash-cartoons)/([A-z0-9_-]+)$
And why does this not work: ^flash-cartoons/([A-z0-9_-]+)$
And last why: Why i can't use this "stressed" (Unterstrich) like this:
^(flash_cartoons)/([A-z0-9_-]+)$
But anyway, thank you (all) very much and now i have to build in some scripts from Dynamic Drive. ;)
See ya later, miow ^^
-
Regular expressions are hard to learn. I am not an expert either. Someone else may be able to explain better.
Here are some guesses about why:
1. The underscore character _ is probably a symbol that has a meaning in regex. Like parentheses (), it may do something to the code. Therefore, it can't be entered as a literal (a character that matches, rather than a character that modifies). Often, the way to work around this is to "escape" the character. This means placing a slash before it. It is often used with quotes, like 'can\'t'. In this case if you use \_ it might work.
2. The parentheses create a group. For some reason this works better. I'm not sure why, but this is probably because within parentheses the letters don't mean anything else. Outside the parentheses, they might. For example "d" means "digit" (number) so you could match any single-character number, like 1, 5, or 0. I'm not sure exactly why this works like that, but I don't think it is a problem-- if it works now, that should be fine.
-
Ahhh, well ehmmm, i don't need to say i love you or? :D
To the facts:
"Underscore" ( _ ) wasn't right from google-translate. I hate this. ^^ I typed "Unterstrich" in (attention: ) lowercase. The answer was "stressed".
And just now i type Uppercase "Unterstrich"...tadaaaa... (happiness^^) => "Underscore".
What i want to say with this?
I'm learning by doing.
Like this with htaccess, like with php, like with html...and so on.
32 years old how i am, it is my goal, all what i can learn with american (-power ^^) help, to turn it over in my homepage sourcecode.
Yes, it IS hard. :D
But i think you know this. Everybody does know this since he started an own homepage with certain(s ?) personal goals.
Uhh, maybe bad english. I know. ;)
However.
You wrote the one word, i've seeing it at my last javascript snippet included my homepage:
"Escape" the character!
Well, that explains many many things for me. (Include the question about "(flash-cartoons)" and so on.)
Ok, like i said, that explains a lot!!!
Thank you very much!!!!
To the second one, i'm wondering about a bit, because i've never thought sooo far about it. It's very intelligent. Since existing mod_rewrite (i believe anything in the end of the 90's), i've never interested about this and now i realize, it's nearby more powerful then php.
I just say. Because i had years before begin to read about it.
Hope you know what i mean.
So before we come to an end with this "discussion", i have to say thank you. Because (you know about this), you explain me soo much and i swear to god, no one of the other ones in germany could not enlighten(explain) me about that.
You don't know how you helped me soo much.
It's all clear for me and i guess, i have to read more about some apache-tools. ;)
Best wishes and Greetings, your miow