.htaccess
Aus Mein Wiki
Sebra  (Diskussion | Beiträge)  (→Url-Rewriting / Speaking-Urls mit .htaccess)  | 
		Sebra  (Diskussion | Beiträge)   (→Cheat Sheets)  | 
		||
| Zeile 15: | Zeile 15: | ||
* http://stackoverflow.com/questions/2803040/apache-rewrite-mod-rewriterule-path-and-query-string  | * http://stackoverflow.com/questions/2803040/apache-rewrite-mod-rewriterule-path-and-query-string  | ||
| - | |||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
* http://www.askapache.com/htaccess/modrewrite-tips-tricks.html  | * http://www.askapache.com/htaccess/modrewrite-tips-tricks.html  | ||
| + | == Samples ==  | ||
| - | |||
  #Sending requests to a php script ^  |   #Sending requests to a php script ^  | ||
  #This .htaccess rewrite example invisibly rewrites requests for all Adobe pdf    |   #This .htaccess rewrite example invisibly rewrites requests for all Adobe pdf    | ||
  #files to be handled by /cgi-bin/pdf-script.php  |   #files to be handled by /cgi-bin/pdf-script.php  | ||
  RewriteRule ^(.+)\.pdf$  /cgi-bin/pdf-script.php?file=$1.pdf [L,NC,QSA]  |   RewriteRule ^(.+)\.pdf$  /cgi-bin/pdf-script.php?file=$1.pdf [L,NC,QSA]  | ||
| + | |||
| + |  #Redirects all files that end in .html to be served from filename.php so it   | ||
| + |  #looks like all your pages are .html but really they are .php  | ||
| + |  RewriteRule ^(.*)\.html$ $1.php [R=301,L]  | ||
| + | |||
| + |  RewriteEngine On  | ||
| + |  RewriteCond %{HTTP_USER_AGENT} ^.*mobile.*$ [NC]  | ||
| + |  RewriteRule /path/index.php /path/iphone.php [QSA,L]  | ||
| + |  #EDIT: QSA is Query string append, so you don't need to handle that    | ||
| + |  #differently. If you want you can add an extra parameter too, like:  | ||
| + |  RewriteRule /path/index.php /path/iphone.php?extra=param [QSA,L]  | ||
= Authentifizierung mit .htaccess =  | = Authentifizierung mit .htaccess =  | ||

