Apache :: Write HTAccess Rules For Dynamic Pages
Feb 15, 2013I'm really struggling to write htaccess rules for dynamic pages. I've like 20 pages to redirect What I want to do is redirect:
[URL] ....
to
[URL] ....
I'm really struggling to write htaccess rules for dynamic pages. I've like 20 pages to redirect What I want to do is redirect:
[URL] ....
to
[URL] ....
how can I rewrite a dynamic image url? URL....
View 3 Replies View RelatedI have learned some bits of regular expressions for simple scripting, writing a .htaccess file is, uh, syntaxically daunting.
THE CASE :
The URLs of my site used to be of the form [URL] ... . They are now of the form [URL]......
I am trying to perma-redirect (301) the old format (affiche_fiche.php) to the new format (fiche.php) using a .htaccess.
So far all I have achieved is a hatred of punctuation signs. What's the correct syntax to have a .htaccess that does the redirect ?
THE CONTEXT : The format change took place more than six months ago, but the Google Webmaster Tools still spits 450 problems a day with 404s on URLs using the old format. I had assumed that these would just fade away, but they don't. So I guess that 301'ing them is cleaner. Or would be, if I understood the syntax.
I have some instructions written in the .htaccess of root directory for my website. So how to force those rules to apply to all sub directories even if those sub directories have .htaccess that overwrite the rules of the mother .htaccess on the root directory ? For example the root .htaccess deny access to all *.log files, so how to force that rule even if in some subdirectories there is some .htaccess files that allow access of *.log files.
View 1 Replies View RelatedHow can i prevent error 302 in my site? for example, this [URL] .... is showing a status 200
But this same [URL] .... is showing me a status 302 (note the lack of forward slash)
Every folder in my site is showing this 302 error, so i tried to do a redirect in order to fix this, but its not working.
I think its the htaccess doing this kind of redirects in my hole site but I am new to this file, so i dont know how to fix this. Rules in my htaccess are here:
(I cant write into htaccess, but I can see the content of the file)...
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www.saludymedicinas.com.mx [NC]
RewriteRule (.*) http://www.saludymedicinas.com.mx/$1 [R=301,L]
i have made my all pages with .html extension and hence my SEO is based on accordingly. Now i made some changes to htaccess that causes to not inclusion of header and footer pages (both are made with .php extension ). so i decided to change the extension of pages (.html to .php) and it wokrs. due to SEO and large number of pages i want all my pages .php (made later). to get converted automatically with .html in browser. so is it possible using .htaccess rewrite.
View 1 Replies View RelatedI have a problem with a site that I'm hosting on a managed dedicated server - I'll try to explain this as simply as possible!
From my office I seem to have a problem viewing dynamic pages on the site.
- The HTML index page loads fine
- Internal dynamic PHP pages throw up 404s
- Other PHP pages/sites on the same server are fine
- The pages load fine using a proxy browser
- I've cleared my cache which made no difference
- From other locations (home) I have never had the problem
I'm obviously worried that I'm not the only person having these problems.
The fact that the site loads fine through a proxy indicates that there's not a problem with the server,
However I'm confused that it's not a local problem as the HTML pages shouldn't be loading either right?
I need to forward some dynamic URL's So for example:
mysite.com?product=1
needs to be directoed to
mysite.com/1.htm
How can I do this in .htaccess?
Ii need to redirect domain.com/register.html , domain.com/search.php and login.html to domain.com/index.php
Do anyone know how to do this with .htaccess?
I'm not to good with htaccess.
I am able to find information on the 2 items I am looking for separately but not together.
I need all pages on a site to redirect to the www ssl version of the page.
so..
[url] > [url]
[url]> [url]
[url]> [url]
I Have Kloxo Runing in my Server , and i use Apache for handling php , and htaccess .
From kloxo Panel under Extra , Error Handling .
I made editing to where visitor will be taken when come to page not found , banned , ..etc
The error 404 , 403,500
But won't work , it just take User to the Apache Test page instaed takes him to the Page i spicifed..
So i edited htaccess like ErrorDocument 403 forbid.php to try redierct the users to the error pages but got same reslut instaed takes them to the apache test page .
I tried install Plesk and Try . But seems the Same thing , when user comes to not found page , or forbidden page he will be directed to Apache test page.
For some reason I have some old urls which just don't want to rewrite. I have lots of others working fine but I think it may be to do with the symbols in these paths which are stopping it from working. Ideally these should be 301'd.
I need view.asp?filter=category%20name to go to category-name
I'm trying to compile PHP 5.2.1 on my Ubuntu 6.10 server. I've downloaded the source code from php.net and am running the following configure command on it:
Code:
./configure --with-apxs2=/usr/bin/apxs2 --with-mysql --with-informix=/opt/informix --enable-shared --enable-pdo=shared --without-sqlite --without-pdo-sqlite --with-pdo-mysql=shared --with-zlib --with-xml --with-pdo-informix=shared,/opt/informix
After doing this, then make, I copy over the generated libphp5.so file into my Apache extensions directory, add extension=pdo.so (and lines for the PDO-MySQL/Informix extensions) into my php.ini and restart Apache. I would expect to see PDO, PDO-MySQL and PDO-Informix listed in my phpinfo() - but they don't appear.
So, I tried recompiling PHP but without any of the PDO extensions being shared. This worked, and I could see PDO and PDO-MySQL in phpinfo(), but not PDO-Informix.
So, can anyone hazard a guess as to why none of the PDO extensions load when compiled shared? I don't get any related error messages in the Apache or System logs by the way....
I transferred my WordPress site to static HTML website, but some other website have a link to my old WordPress site URL....
I want to redirect all traffic from that URL to new URL which is URL...., but my redirect in .htaccess file doesn't work (Redirect 301 /?page_id=1234 URL... because of the query string."mod_rewrite" to create the right code in .htaccess file.
I have been trying to install apache server on a windows pc which will deliver adobe HDS content. there is a specific tutorial for this in the adobe site, can be found here. I have been following it to the word, but when I try to start apache after asking it to load new modules (mod_f4fhttp), it returns me an error saying that the file is not readable/not found. I have installed the proper visual c++ libraries and also checked the permissions and spellings. This seems to be a common error with php modules in apache, but none of the solutions seems to work.
View 1 Replies View RelatedHow do I architect and design a dynamic, white-label website i.e. a site where the components are dynamic based on a path component in the URL?
View 1 Replies View RelatedI am trying to setup dynamic content configuration in apache 2.2 httpd conf. Here is the configuration and couple test cases:
CONF:
<FilesMatch ".(js|css|gif|jpg|jpeg|png)$">
Header set Cache-Control "no-cache, no-store, max-age=0, must-revalidate"
</FilesMatch>
TEST 1:
Without <FilesMatch> directive, the headers are set to all requested content as it should. This includes content served from apache server and content from a separate application server.
TEST 2:
If I use the above configuration example, I can see that static content comes with correct headers only
With this whole no-www thing going on. I've decided to have a look at whether I can do this for my domains.
Instead of writing a
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ h77p://domain.com/$1 [R=301,L]
for every single domain I'd like to do this for across all domains as standard. I'm not too hot on rewrite rules and have in the past avoided them cos of the complexities. But I'd like to get this done, and no silently do it, but reflect the URL difference in the webbrowsers address bar too.
Anyone can give me good rules for apache 2.2.6 / Cpanel , i'm new with this, i've use Apache 1.3.x before.
View 0 Replies View RelatedI got a trouble with a server upgrade on GoDaddy.
Once the server was upgraded from Apache 2.2 to Apache 2.4 all
CentOS 6. Apache 2.2.15
I am trying to redirect a request from a non-hosted domain, using a rewrite rule in our configuration file in conf.d. Our registrar has a pointer from this non-hosted domain to our domain.
Currently
*.domain1.com.vn -> http://www.domain1.com
domain1.com.vn -> http://domain1.com
I want to redirect a request like so in the web.conf file in conf.d
domain1.com.vn/terms => domain2.com/vn/terms
I am writing a rewrite rules using mod_rewrite module. I have the same data repeating all over the rules that I would like to replace with variable and set variable once at the top of rules then use variable in the rest of rules. Then if I need to add another IP address I would just add additional IP address to the variable instead like now need to change several rules.
For example I have IP addresses that I would like to set as a variable.
Now rules are the following (simplified) in httpd.conf:
RewriteEngine Off
RewriteCond %{REMOTE_ADDR} (192.168.5.20|192.168.7.15|10.10.20.50
I'm kinda new to apache and I have the following situation.
I have a vps, on which I have set the following:
WordPress Site A, has it's own VirtualHost and domain
WordPress Site B, has it's own VirtualHost and domain
Canvas LMS (not connected to a domain).
Canvas LMS can add multiple accounts, which may (or may not) be accessed individually using a URL that looks as follows:
{canvas_root}/accounts/{account_id}/
For example : http://....../accounts/4/
I need to add a link to each of WP sites, which points to each site's account on Canvas, such that it appears as .../learning/ folder
For example:
Code:
http://WPSiteA/learning/
http://WPSiteB/learning/
which actually represents
Code:
http://WPSiteA/accounts/4/
http://WPSiteB/accounts/5/
Which in turn represents
Code:
http://{my_vps_ip}/accounts/4/
http://{my_vps_ip}/accounts/5/
respectively
Noticing the following:
I do not want the users to see the /account/4/ , just /learning/
I also want to prevent accessing
Canvas LMS is located beyond the website's DocumentRoot
I want this to work with both HTTP and HTTPS
How to convert apache rewrite rule to nginx:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^naujienos+ news.php/$1 [L]
RewriteRule ^naujienos/p(.*)$ /news.php?pg=$1 [nc]
RewriteRule ^naujienos/?$ /news.php [nc]
RewriteRule ^naujienos?$ /news.php [nc]
I am having this issue with a new box where Apache at random serves blank pages and won't serve anything but until it's restarted. I see no errors in /var/log/messages either to show why this is happening.
It's not all pages either just several various ones. I know it's not a programming issue either because the only thing the server is running is one instance of vBulletin.
I look at top during this and CPU and RAM usage are very low.
The only fix to get Apache to serve the pages is to restart it.
Anyone have any clues on what it could be?
I set my php.ini memory limit to a gig (I have 16 gigs in the sever)
How do I add multiple web pages to my server?
View 6 Replies View RelatedI am delivering my php scripts from a new Apache server on CentOS delivering them only at the end of the loading. What is a pain, especially for pages being used by iOS apps just needing the xml section even if the script goes further, or when presenting information while they are generated.
View 3 Replies View RelatedLooking trough my logs I found something that bothers me, there are bots who keep doing requests on my website with pages like /admin or /secure to find vulnerabilities.
It's making about 5-6 requests for unexisting pages every second until it comes to the end of it's dictionary (the pages are even sorted in alphabetical order,
Is there some way to let my Apache server block access to these bots when they make X attemps to see a page who does not exists in a short amount of time? A bit like iptables reject connection if someone tries to log in but fails to do so too many times.
I'm hoping to redirect visits to any page in an old directory to the index page of a new directory.
In other words, redirect:
[URL] ....
[URL] ....
Is this possible? If so, how could I do it?
In my .htaccess I currently have:
Code :
RedirectPermanent /facts/ http://www.domain.com/newfacts/
but this only redirects the index page.
I work for a company with a highly trafficked site (about 100,000 unique daily visitors). We have our "MANAGED" hosting through Rackspace for quite the pretty penny per month. It includes a dedicated back end / DB server and cloud servers for the front end.
The setup has been functioning perfect for 10 months now; but this past Monday the speed of the site immediately dropped. Page load times fell from 1-2 seconds to between 10-20 seconds, and sometimes not at all. As far as we know (and as far as Rackspace says), no server setting were modified. No new code was introduced on our end. It's a mainly static site, with minimal user interaction with the backend at all.
We've monitored the traffic, checked IPs, etc. We've even tunes down several site features in the interest of reducing server load. Upon a server reboot, the active threads/processes running on it IMMEDIATELY jump back up to maxed out levels. It seems like once our daily traffic reaches 10MB/s, a type of queue forms and the delays begin. Rackspace assures us that we're not limited to that.
Versions:
OS: cent OS on cloud
OS: Redhat on Dedicated Server
Apache: 2.2
PHP: 5.3 / MySQL: 5.1.69
Some more background info: The site is typically busiest from 7am until 3pm EST. For the past few days, we've noticed that between 7am and 9-10pm the server has just lagged incredibly. However, at around that 9-10pm mark, something changes and the pages go back to loading almost instantly. (There is still decent traffic though.) Then at around 7am again it slows to a crawl.
Rackspace has offered solutions such as spinning up another server and incorporating their load balancing - they are in the process of this BUT they do NOT think the traffic is the issue. At one point they actually said there was potential packet loss somewhere in the network, but no progress has been made.