Tag Archives: url

Redirect Without changing URL Apache

Questions: I want to redirect one URL to another without changing the Browser URL www.example.com/abc/(.*).xml should redirect to www.example.com/abc/xyz/index.htm?file=$1 But the Browser should display www.example.com/abc/(.*).xml Answers: You can use a RewriteRule: RewriteEngine On RewriteRule /abc/(.*)\.xml$ /abc/xyz/index.htm?file=$1 [L] Make sure you have mod_rewrite enabled and put this either in your VirtualHost config, or in a .htaccess… Read More »

Passenger starting on all urls except the root url

Questions: I’m trying to deploy a rails 4.1.0 application to my production environment with apache (2.4.17), rvm and passenger (4.0.59). The problem is, I keep getting the apache directory listing of the public directory when I go to the url (www.myapp.com) of my vhost. But: When I navigate to a route inside my rails-app, e.g;… Read More »

htaccess Rewrite URL based on TLD

Questions: On my website, I am interested in moving my forums from a subdirectory to a subdomain. The forums are currently located at example.com/forums, and I want to move them to forums.example.com. After the move, I want to use htaccess to 301 redirect all forum traffic to the subdomain, but the problem is that I… Read More »

How is a URL modified by more than one rewrite rule in htaccess?

Questions: I would like to ask a question in order to understand how Apache processes rewrite rules specified in the .htaccess file. On my site I used a classical organization of the pages in categories, each category having more than one section: http://www.mysite.com/category/section.html. However, there are no html pages, everything is processed by the code… Read More »

URL Rewriting for images and css

Questions: I wonder if anyone can help with the below and if it is even possible. I have a server running apache and know a little about url re-writing and wondered if it is possible to use url rewriting for paths for images and css. so my current file structure is this: /index.php /theme/css/default.css /theme/images/image1.jpg… Read More »

How to remove the application name in URL? tomcat + httpd

Questions: everyone I made a web application by Apache Click Framework, and just throwed it into tomcat behind httpd. (assume my domain name is www.domain.com.) So I can access my app by the URL: www.myDomain.com/myApp/pages/login.htm My questions is, how to remove the “myApp” part in this url by configuration in httpd or tomcat? because my… Read More »

Is it possible to query a database using a value passed in a URL, and write the result of the query to the URL using mod_rewirite?

Questions: Is it possible to use mod_rewrite to write an htaccess rule that takes a url paramater value (for example: id=1, where ‘id’ is the paramater, and ‘1’ is the parameter value), query a database with the parameter value specified, and then write the value returned from the query as a part of the url… Read More »

htaccess redirect URL using partial value of string parameter

Questions: I have a bunch of products listed at https://www.example.com/all/products/foldername/1234567890-ProductDescriptionA-456.html https://www.example.com/all/products/foldername/7654321-SomeOtherDesc-B123.html https://www.example.com/all/products/foldername/93939393-anotherthing-F93939393.html and I want these to be redirected to https://www.example.com/products.php?p=1234567890 https://www.example.com/products.php?p=7654321 https://www.example.com/products.php?p=93939393 respectively. Is there an htaccess rule to do string operations on a matched parameter? For example, if I had to convert my URL using Python, it would look like this: def make_new_url(old_url):… Read More »

htaccess redirect url with parameters

Questions: I have hundreds of links like this: http://www.domain.com/index.php?tag=value I want to redirect all links to http://www.domain.com/value/ Example: Link1 http://www.domain.com/index.php?tag=LW1fdX49tR redirect to: http://www.domain.com/LW1fdX49tR/ Link2 http://www.domain.com/index.php?tag=A3kh0QLIrc redirect to: http://www.domain.com/A3kh0QLIrc/ Link3 http://www.domain.com/index.php?tag=vXwNR4U9qY redirect to: http://www.domain.com/vXwNR4U9qY/ etc How can I do that? Thank you! Answers: Besides redirecting the request, you probably want to make sure the new url… Read More »

PHP htaccess Redirect url with query string from uppercase to lowercase

Questions: I have this small php script and couple lines in htaccess to redirect urls with query strings from uppercase to lowercase. However, it redirects uppercase characters in query string to lowercase ones only if there is an uppercase character in the url file or directory part of the url. Example with uppercase directory: domain.com/JOBS/?position=Java+Developer… Read More »