Rebelrebellious
Members-
Posts
78 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
-
Location
Chicago, IL
Rebelrebellious's Achievements
Member (2/5)
0
Reputation
-
Help needed with .htaccess RewriteRules
Rebelrebellious replied to Rebelrebellious's topic in Apache HTTP Server
So at this point it is mostly working. RewriteCond $1 ^public/(.+)$ RewriteCond %1 ^(.*)\.(.+)$ RewriteCond %1 !^.*/.*$ #RewriteCond %1 !/ RewriteRule ^(public/.+)$ public/%2/%1.%2 [L,E=REWRITE:%{ENV:REWRITE}-$1] # send almost everything to the main program file # prevent the request from going to the main program if the file exists in public/ RewriteCond $1 !^public/.*$ RewriteCond $1 !^main\.php$ RewriteRule ^(.*)$ /main.php [L,QSA,E=REWRITE:%{ENV:REWRITE}-$1] Is there any way to do away with RewriteCond $1 !^main\.php$ ? -
Help needed with .htaccess RewriteRules
Rebelrebellious replied to Rebelrebellious's topic in Apache HTTP Server
Okay. I finally got the first part working. Hopefully the rest comes together quickly. # allow requests for public files to go through RewriteCond $1 ^public/(.+)$ RewriteCond %1 ^(.*)\.(.+)$ RewriteCond %1 !^.*/.*$ #RewriteCond %1 !/ RewriteRule ^(public/.+)$ public/%2/%1.%2 [NC,L,E=REWRITE:%{ENV:REWRITE}-$1] -
[SOLVED] Rewrite rule ignoring directories
Rebelrebellious replied to jcombs_31's topic in Apache HTTP Server
Thanks. I thought that the / indicated the base path for the website, but based on apache behavior you seem to be correct. -
Help needed with .htaccess RewriteRules
Rebelrebellious replied to Rebelrebellious's topic in Apache HTTP Server
So to simplify the problem, I have commented out everything except: # allow requests for public files to go through #RewriteCond $1 ^%{DOCUMENT_ROOT}/public/.+ [NC] RewriteCond $1 !^%{DOCUMENT_ROOT}/public/.+/.*\..+$ [NC] RewriteRule ^public/(.*)\.(.+)$ /public/$2/$1.$2 [NC,L,E=REWRITE:%{ENV:REWRITE}-public/$1.$2] if I request http://domain/public/ I get 403 Forbidden if I request http://domain/public/favicon.ico I get 500 if I request http://domain/public/ico/favicon.ico I get 500 Please help me work through this. -
Not Getting $_SERVER['REMOTE_USER'] to work with WAMP
Rebelrebellious replied to nibble's topic in Apache HTTP Server
You may not need to go through mod_rewrite. Does this help? http://php.net/manual/en/function.getenv.php getenv('username') -
Sorry, I think this may be better: RewriteRule ^/provincial/bc/(.*)$ /$1 [NC,L] or if that doesn't work, try: RewriteRule ^provincial/bc/(.*)$ /$1 [NC,L] I am curious about which solution works.
-
[SOLVED] Rewrite rule ignoring directories
Rebelrebellious replied to jcombs_31's topic in Apache HTTP Server
You should mark this as solved. I understand that your discovery is that multiviews supercedes mod_rewrite and doesn't even attempt to rewrite the solution it finds. That's good to know. As an aside, would you script be improved by adding a / to the beginning of your regex so? RewriteRule ^/info/([a-z]+)/?$ info.php?page=$1 [NC,L] Or doesn't that work at all? Shouldn''t the request be starting with /? -
But add the dynamic part and remove the Redirect flag: RewriteRule http://www.domainname.com/provincial/bc/(.*) http://www.domainname.com/$1 [NC,L]
-
I think that you need to stop the last one from happening to the requests that you have already changed. Even though you specified Last, the .htaccess file is reprocessed for each sub directory(I think) so: RewriteCond %{SCRIPT_NAME} !\.php RewriteRule ^cp[/]*?$ _cp/$1 [L] RewriteRule ^css/(.*)$ /_inc/css/$1 [L] RewriteRule ^js/(.*)$ /_inc/js/$1 [L] RewriteRule ^img/(.*)$ /_inc/img/$1 [L] RewriteRule ^files/(.*)$ /_user/files/$1 [L] RewriteCond $1 !^(_cp/|/_inc/css/|/_inc/js/|/_inc/img/|/_user/files/) RewriteRule ^(.*)$ index.php?page=$1 [L,QSA] Also, if you want that first RewriteCond to stop all php requests then you may want add a rule to skip the next 5 RewriteRules. RewriteCond %{SCRIPT_NAME} !\.php RewriteRule - [s=5] RewriteRule ^cp[/]*?$ _cp/$1 [L] RewriteRule ^css/(.*)$ /_inc/css/$1 [L] RewriteRule ^js/(.*)$ /_inc/js/$1 [L] RewriteRule ^img/(.*)$ /_inc/img/$1 [L] RewriteRule ^files/(.*)$ /_user/files/$1 [L] RewriteCond $1 !^(_cp/|/_inc/css/|/_inc/js/|/_inc/img/|/_user/files/) RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]
-
What do I need? URL redirect query
Rebelrebellious replied to richrock's topic in Apache HTTP Server
Are you looking for a rewrite or a redirect? I think that you may need to use the QSA flag to append your new query to the old query. That space between the carat and the willmott is not good. If that doesn't work, check in your error logs (found in cpanel, or wherever you keep them) for a clue. for rewrite: RewriteRule ^willmott index.php?option=com_content&view=article&id=130:paul-a-vanessa-willmott&catid=36:full-time-evangelists&Itemid=56&authid=91 [L,QSA,R] for redirect just remove the R flag: RewriteRule ^willmott index.php?option=com_content&view=article&id=130:paul-a-vanessa-willmott&catid=36:full-time-evangelists&Itemid=56&authid=91 [L,QSA] -
please help with mod-rewrite (please)
Rebelrebellious replied to louis_coetzee's topic in Apache HTTP Server
Does this work? RewriteEngine On RewriteRule !(\.swf|\.gif|\.png|\.jpe?g|\.css|\.js|\.php|\^public/|^admin/.*)$ index.php [nocase,last] -
Help needed with .htaccess RewriteRules
Rebelrebellious replied to Rebelrebellious's topic in Apache HTTP Server
After making some changes I am now getting my main.php. The main.php should not be coming up because the file favicon.ico should be found after the first rewrite succeeds (which isn't happening) and the second rewrite prevents the third rewrite from happening. Here is the current script: # allow requests for public files to go through RewriteCond $1 ^/public/ [NC] RewriteCond $1 !^/public/.+/.*\..*$ [NC] RewriteRule ^/public/(.*)\.(.*)$ /public/$2/$1.$2 [NC,L,E=REWRITE:%{ENV:REWRITE}-public/$1.$2] # prevent the request from going to the main program if the file exists in public/ext/ RewriteCond $1 ^public/(.*)$ #RewriteCond %{REQUEST_FILENAME} -f [NC] RewriteCond $1 -f [NC] RewriteRule .* - [L] # send almost everything to the main program file RewriteCond $1 !^main\.php$ [NC] #RewriteCond $1 !^/public/(.*)$ [OR] #RewriteCond $1 !-f #RewriteRule (.*) /main.php [L,QSA,E=REWRITE:%{ENV:REWRITE}-$1] RewriteRule ^(.*)$|^$ /main.php [L,QSA,E=REWRITE:%{ENV:REWRITE}-$1] -
Although the file http://domain.net/public/ico/favicon.ico exists the following instructions give me a 500 when I request http://domain.net/public.ico # allow requests for public files to go through RewriteCond $1 ^/public/ [NC] RewriteCond $1 !^/public/.*/.*\..*$ [NC] RewriteRule ^/public/(.*)\.(.*)$ /public/$2/$1.$2 [N,NC,E=REWRITE:%{ENV:REWRITE}-public/$1.$2] # prevent the request from going to the main program if the file exists in public/ext/ RewriteCond $1 ^/public/(.*)$ RewriteCond %{REQUEST_FILENAME} -f [NC] #RewriteCond $1 -f [NC] RewriteRule .* - [L] # send almost everything to the main program file RewriteCond $1 !^/main\.php$ [NC] #RewriteCond $1 !^/public/(.*)$ [OR] #RewriteCond $1 !-f RewriteRule (.*) /main.php [L,QSA,E=REWRITE:%{ENV:REWRITE}-$1] I've been struggling with this for way too long. Please help,
-
Hey Xylex, thanks. I hope you are right because the schedule I am working with is packed solid.
-
Thanks for the input Waynewex, but I'm not catching the relevancy of your post. For my own purposes I am estimating that with a two class per semester load I should set aside 30 hours per week. I'm making no guarantees that this is realistic, but it is the sort of number I wanted.