Sponsored Content
Top Forums Web Development Regex to rewrite URL to another URL based on HTTP_HOST? Post 302479748 by JoyceBabu on Sunday 12th of December 2010 09:53:26 PM
Old 12-12-2010
Will this work? Are you looking for a redirect? If not, I think it is better to rewrite to the substitution for Nevow.Athena.v2 rather than Nevow.Athena.v2.


Put this in the .htaccess file in your document root
Quote:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^SUB.DOMAIN.COM$ [NC]
RewriteRule (showAssignment/[a-z0-9]+/jsmodule/Nevow.Athena)$ $1.v2 [NC,QSA,L]
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

url calling and parameter passing to url in script

Hi all, I need to write a unix script in which need to call a url. Then need to pass parameters to that url. please help. Regards, gander_ss (1 Reply)
Discussion started by: gander_ss
1 Replies

2. Shell Programming and Scripting

url calling and parameter passing to url in script

Hi all, I need to write a unix script in which need to call a url. Then need to pass parameters to that url. please help. Regards, gander_ss (1 Reply)
Discussion started by: gander_ss
1 Replies

3. Cybersecurity

APACHE rewrite / redirect URL

Hello. I have scenario where a Client send request to Server1. Server1 send request to Server2. Request are xmlHTTPRequest - need to get data (XML) from Server2 back to client. Trying to use APACHE proxy... Anyone can help? What to download / configure / ...? Thank you for your help. (1 Reply)
Discussion started by: ampo
1 Replies

4. Web Development

APACHE rewrite / redirect URL

Hello. I have scenario where a Client send request to Server1. Server1 send request to Server2. Request are xmlHTTPRequest - need to get data (XML) from Server2 back to client. Trying to use APACHE proxy... Anyone can help? What to download / configure / ...? Thank you for your... (2 Replies)
Discussion started by: ampo
2 Replies

5. Red Hat

Need some help on tomcat URL rewrite or mod_jk

I am trying to remove the context name from the url of my server. Current URL - http://www.domainname.com/MyApp/ What I need to make is to make it avaialble at - http://www.domainname.com/ I have already tried couple of things like below - RewriteEngine On RewriteCond... (0 Replies)
Discussion started by: rockf1bull
0 Replies

6. UNIX for Dummies Questions & Answers

Awk: print all URL addresses between iframe tags without repeating an already printed URL

Here is what I have so far: find . -name "*php*" -or -name "*htm*" | xargs grep -i iframe | awk -F'"' '/<iframe*/{gsub(/.\*iframe>/,"\"");print $2}' Here is an example content of a PHP or HTM(HTML) file: <iframe src="http://ADDRESS_1/?click=5BBB08\" width=1 height=1... (18 Replies)
Discussion started by: striker4o
18 Replies

7. Web Development

Append query string via URL rewrite in apache

Hi, Googled around but I couldn't find anything similar. I'm looking to do the following in apache.. if a user comes into the following URL. http://www.example.com/some/thing.cid?wholebunch_of_stuff_here keep the URL exactly as is BUT add &something at the very end of it. thanks in... (1 Reply)
Discussion started by: kmaq7621
1 Replies

8. Web Development

Mod_rewrite - URL rewrite based upon HTTP_REFERER

Hello, I have added following rewrite cond and rewrite rules but it does not work. RewriteCond %{HTTP_REFERER} ^http://192\.168\.1\.150/categories/.*$ RewriteRule ^(.*)$ http://www.blahblah.com/ When I hit url : http://192.168.1.150/categories/881-Goes?page=7 in my browser - it... (2 Replies)
Discussion started by: ashokvpp
2 Replies

9. Shell Programming and Scripting

Reading URL using Mechanize and dump all the contents of the URL to a file

Hello, Am very new to perl , please help me here !! I need help in reading a URL from command line using PERL:: Mechanize and needs all the contents from the URL to get into a file. below is the script which i have written so far , #!/usr/bin/perl use LWP::UserAgent; use... (2 Replies)
Discussion started by: scott_cog
2 Replies

10. UNIX for Beginners Questions & Answers

Regex for a valid URL

Hi guys, What is the regex to check for only valid URL from a file using grep? (2 Replies)
Discussion started by: Meeran Rizvi
2 Replies
YAF_ROUTER(3)								 1							     YAF_ROUTER(3)

The Yaf_Router class

INTRODUCTION
Yaf_Router is the standard framework router. Routing is the process of taking a URI endpoint (that part of the URI which comes after the base URI: see Yaf_Request_Abstract::setBaseUri) and decomposing it into parameters to determine which module, controller, and action of that controller should receive the request. This values of the module, controller, action and other parameters are packaged into a Yaf_Request_Abstract object which is then processed by Yaf_Dispatcher. Routing occurs only once: when the request is initially received and before the first controller is dispatched. Yaf_Router is designed to allow for mod_rewrite-like functionality using pure PHP structures. It is very loosely based on Ruby on Rails routing and does not require any prior knowledge of webserver URL rewriting. It is designed to work with a single Apache mod_rewrite rule (one of): Example #1 Rewrite rule for Apache RewriteEngine on RewriteRule !.(js|ico|gif|jpg|png|css|html)$ index.php or (preferred): Example #2 Rewrite rule for Apache RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] If using Lighttpd, the following rewrite rule is valid: Example #3 Rewrite rule for Lighttpd url.rewrite-once = ( ".*?(.*)$" => "/index.php?$1", ".*.(js|ico|gif|jpg|png|css|html)$" => "$0", "" => "/index.php" ) If using Nginx, use the following rewrite rule: Example #4 Rewrite rule for Nginx server { listen ****; server_name yourdomain.com; root document_root; index index.php index.html; if (!-e $request_filename) { rewrite ^/(.*) /index.php/$1 last; } } DEFAULT ROUTE
Yaf_Router comes preconfigured with a default route Yaf_Route_Static, which will match URIs in the shape of controller/action. Addition- ally, a module name may be specified as the first path element, allowing URIs of the form module/controller/action. Finally, it will also match any additional parameters appended to the URI by default - controller/action/var1/value1/var2/value2. Note Module name must be defined in config, considering application.module="Index,Foo,Bar", in this case, only index, foo and bar can be considerd as a module name. if doesn't config, there is only one module named "Index". Some examples of how such routes are matched: Example #5 Yaf_Route_Static(default route)example // Assuming the following configure: $conf = array( "application" => array( "modules" => "Index,Blog", ), ); Controller only: http://example/news controller == news Action only(when defined yaf.action_prefer=1 in php.ini) action == news Invalid module maps to controller name: http://example/foo controller == foo Module + controller: http://example/blog/archive module == blog controller == archive Module + controller + action: http://example/blog/archive/list module == blog controller == archive action == list Module + controller + action + params: http://example/blog/archive/list/sort/alpha/date/desc module == blog controller == archive action == list sort == alpha date == desc CLASS SYNOPSIS
Yaf_Router Yaf_Router Properties o protected$_routes o protected$_current Methods o public bool Yaf_Router::addConfig (Yaf_Config_Abstract $config) o public bool Yaf_Router::addRoute (string $name, Yaf_Route_Abstract $route) o public Yaf_Router::__construct (void ) o public string Yaf_Router::getCurrentRoute (void ) o public Yaf_Route_Interface Yaf_Router::getRoute (string $name) o public mixed Yaf_Router::getRoutes (void ) o public bool Yaf_Router::route (Yaf_Request_Abstract $request) PROPERTIES
o $_routes - registered routes stack o $_current - after routing phase, this indicated the name of which route is used to route current request. you can get this name by Yaf_Router::getCurrentRoute. PHP Documentation Group YAF_ROUTER(3)
All times are GMT -4. The time now is 10:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy