Search Results

Search found 906 results on 37 pages for 'rewriteengine'.

Page 2/37 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How can I avoid an error in this .htaccess file?

    - by mipadi
    I have a blog. The blog is stored under the /blog/ prefix on my website. It has the usual URLs for a blog, so articles have URLs in the format /blog/:year/:month/:day/:title/. First and foremost, I want to automatically redirect visitors to the www subdomain (in case they leave that off), and internally rewrite the root URL to /blog/, so that the front page of the blog appears on the front page of the site. I have accomplished that with the following set of rewrite rules in my .htaccess file: RewriteEngine On # Rewrite monkey-robot.com to www.monkey-robot.com RewriteCond %{HTTP_HOST} ^monkey-robot\.com$ RewriteRule ^(.*)$ http://www.monkey-robot.com/$1 [R=301,L] RewriteRule ^$ /blog/ [L] RewriteRule ^feeds/blog/?$ /feeds/blog/atom.xml [L] That works fine. The problem is that the front page of the blog now appears at two distinct URLs: / and /blog/. So I'd like to redirect the /blog/ URL to the root URL. Initially I tried to accomplish this with the following set of rewrite rules: RewriteEngine On # Rewrite monkey-robot.com to www.monkey-robot.com RewriteCond %{HTTP_HOST} ^monkey-robot\.com$ RewriteRule ^(.*)$ http://www.monkey-robot.com/$1 [R=301,L] RewriteRule ^$ /blog/ [L] RewriteRule ^blog/?$ / [R,L] RewriteRule ^feeds/blog/?$ /feeds/blog/atom.xml [L] But that gave me an infinite redirect (maybe because of the preceding rule?). So then I tried this set: RewriteEngine On # Rewrite monkey-robot.com to www.monkey-robot.com RewriteCond %{HTTP_HOST} ^monkey-robot\.com$ RewriteRule ^(.*)$ http://www.monkey-robot.com/$1 [R=301,L] RewriteRule ^$ /blog/ [L] RewriteRule ^blog/?$ http://www.monkey-robot.com/ [R,L] RewriteRule ^feeds/blog/?$ /feeds/blog/atom.xml [L] But I got a 500 Internal Server Error with the following log message: Invalid command '[R,L]', perhaps misspelled or defined by a module not included in the server configuration What gives? I don't think [R,L] is a syntax error.

    Read the article

  • Enabling `mod_rewrite` apache, permissions issues

    - by rudolph9
    In attempting to enable mod_rewrite on the Apache2 web server installed with Mac OSX 10.7.4. Following these instruction, ultimately using the configuration to host CakePHP applications, I run into permissions issues accessing the site via a web browser when I set the directory block associated with cakephp site /etc/apache2/users/username.conf from: <Directory "/Users/username/Sites/"> Options Indexes FollowSymLinks MultiViews AllowOverride none Order allow,deny Allow from all </Directory> /etc/apache2/users/username.conf to: <Directory "/Users/username/Sites/"> Options Indexes MultiViews AllowOverride none Order allow,deny Allow from all </Directory> <Directory "/Users/username/Sites/cakephp_app/"> Options Indexes FollowSymLinks MultiViews AllowOverride all Order allow,deny Allow from all </Directory> The .htaccess files are the CakePHP 2.2.2 default as follows: /Users/username/Sites/cakephp_app/.htaccess <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </IfModule> /Users/username/Sites/cakephp_app/app/.htaccess <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L] </IfModule> /Users/username/Sites/cakephp_app/app/webroot/.htaccess <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L] </IfModule> When performing the request via a web browser at to http://0.0.0.0/~username/cakephp_app/index.php the content of the response is Not Found The requested URL /Users/username/Sites/cakephp_app/app/webroot/ was not found on this server. Apache/2.2.21 (Unix) DAV/2 PHP/5.3.10 with Suhosin-Patch Server at 0.0.0.0 Port 80 Upon a request to http://0.0.0.0/~username/ and http://0.0.0.0/~username/cakephp_app/, added to /var/log/apache2/error_log accordingly are the following: [Tue Sep 04 22:53:26 2012] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/Users, referer: http://0.0.0.0/~username/ [Tue Sep 04 22:53:26 2012] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/favicon.ico What is causing the issue? Is there server program, ideally available via a homebrew script, which would make hosting CakePHP applications for testing purposes more effective and efficient?

    Read the article

  • .htaccess rules to have cakephp in root and wordpress in subfolder

    - by cc-mf
    Hello, How can I combine the .htaccess rules for cakephp RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] with the following RewriteEngine On RewriteCond %{HTTP_HOST} folder.yoursite.com RewriteRule ^(.*)$ /folder [L] in other words redirect anything to app/webroot/ except /blog (wich is an exisiting folder with a wordpress installation) and redirect blog.domain.com to the blog subfolder Thank you very much

    Read the article

  • Using .htaccess to force https on all requests in Zend MVC

    - by davykiash
    I have been battling with .htaccess to get all the requests to use https on my Zend MVC. What am seeing is that SSL turns "on" and then goes "off" as the page loads. Below is my .htaccess file. SetEnv APPLICATION_ENV production RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} What do I need to adjust to get my https working properly?

    Read the article

  • Staging server .htaccess for images, css and js

    - by Gavin Hall
    As we build and demo sites on our staging server with individual root folders for each such as /CLIENTNAME, we need to keep all the css, js and internal links for these sites referencing the server root. The following works for one folder each, but not sure how to adapt to work for all folders. Currently AddHandler php5-script .php RewriteEngine On RewriteRule ^(images|css|js)\/(.*) /ONEFOLDER/$1/$2 Would like AddHandler php5-script .php RewriteEngine On RewriteRule ^(images|css|js)\/(.*) /EVERYFOLDER/$1/$2 Many thanks in advance.

    Read the article

  • Redirecting only if user asks for the root of the domain nad are froma particular country

    - by lphmedia
    Hi, I need a rule and condition to handle this scenario: User from US visits www.domain.com, domain.com, www.domain.com/ or domain.com/ this should be redirected to www.domain.com/usvisitor/ However, if a user from the US visits www.domain.com/anydirectory it will let them straight through without a redirection occurring. eg. RewriteEngine On RewriteBase / GeoIPEnable On GeoIPDBFile /var/share/GeoIP/GeoIP.dat RewriteEngine on RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^US$ RewriteCond %{HTTP_HOST} ^domain.com$ [L] RewriteRule ^/$ http://www.domain.com/usvisitor$1 [L] I know the RewriteConditons and rules are wrong - just can't get my head around it!

    Read the article

  • mod_rewrite - Don't get a second rule work

    - by poru
    I want to have a url like this: domain.com/css/site.css?test=234 Rule: RewriteEngine On RewriteRule ^([a-z]+)/$ $1.php RewriteRule ^css/([a-zA-Z0-9]+).css?count=(.*)$ css.php?f=$1&test=$2 But I get every time a 404: Not found (site.css) If I have a rule like that it works, just without getting the $_GET-Variable: RewriteEngine On RewriteRule ^([a-z]+)/$ $1.php RewriteRule ^css/([a-zA-Z0-9]+).css$ css.php?f=$1

    Read the article

  • How would I redirect two domains using .htaccess

    - by user302943
    I'm trying to redirect one domain to the root and another to a directory. The problem I'm having is the second domain is overwriting the firsts redirection. Here is what I have. RewriteEngine On RewriteCond %{HTTP_HOST} !^http://example.site.net$ [NC] RewriteCond %{REQUEST_URI} !^/.*$ RewriteRule ^(.*)$ / [L] RewriteEngine On RewriteCond %{HTTP_HOST} !^http://example2.com [NC] RewriteCond %{HTTP_HOST} !^http://www.example2.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteCond %{REQUEST_URI} !^/example2_directory/ RewriteRule ^(.*)$ /example2_directory/$1

    Read the article

  • Apache reverse proxy POST 403

    - by qkslvrwolf
    I am trying to get Jira and Stash to talk to each other via a Trusted Application link. The setup, currently, looks like this: Jira - http - Jira Proxy -https- stash proxy -http- stash. Jira and the Jira proxy are on the same machine. The Jira Proxy is showing 403 Forbidden for POST requests from the stash server. It works (or seems to ) for everything else. I contend that since we're seeing 403 forbiddens in the access log for apache, Jira is never seeing the request. Why is apache forbidding posts,and how do I fix it? Note that the IPs for both Stash and the Stash Proxy are in the "trusted host" section. My config: LogLevel info CustomLog "|/usr/sbin/rotatelogs /var/log/apache2/access.log 86400" common ServerSignature off ServerTokens prod Listen 8443 <VirtualHost *:443> ServerName jira.company.com SSLEngine on SSLOptions +StrictRequire SSLCertificateFile /etc/ssl/certs/server.cer SSLCertificateKeyFile /etc/ssl/private/server.key SSLProtocol +SSLv3 +TLSv1 SSLCipherSuite DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA:AES128-SHA:EDH-RSA-DES-CBC3-SHA:EDH-DSS-DES-CBC3-SHA:DES-CBC3-SHA # If context path is not "/wiki", then send to /jira. RedirectMatch 301 ^/$ https://jira.company.com/jira RedirectMatch 301 ^/gsd(.*)$ https://jira.company.com/jira$1 ProxyRequests On ProxyPreserveHost On ProxyVia On ProxyPass /jira http://localhost:8080/jira ProxyPassReverse /jira http://localhost:8080/jira <Proxy *> Order deny,allow Allow from all </Proxy> RewriteEngine on RewriteLog "/var/log/apache2/rewrite.log" RewriteLogLevel 2 # Disable TRACE/TRACK requests, per security. RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) RewriteRule .* - [F] DocumentRoot /var/www DirectoryIndex index.html <Directory /var/www> Options FollowSymLinks AllowOverride None Order deny,allow Allow from all </Directory> <LocationMatch "/"> Order deny,allow Deny from all allow from x.x.71.8 allow from x.x.8.123 allow from x.x.120.179 allow from x.x.120.73 allow from x.x.120.45 satisfy any SetEnvif Remote_Addr "x.x.71.8" TRUSTED_HOST SetEnvif Remote_Addr "x.x.8.123" TRUSTED_HOST SetEnvif Remote_Addr "x.x.120.179" TRUSTED_HOST SetEnvif Remote_Addr "x.x.120.73" TRUSTED_HOST SetEnvif Remote_Addr "x.x.120.45" TRUSTED_HOST </LocationMatch> <LocationMatch ^> SSLRequireSSL AuthType CompanyNet PubcookieInactiveExpire -1 PubcookieAppID jira.company.com require valid-user RequestHeader set userid %{REMOTE_USER}s </LocationMatch> </VirtualHost> # Port open for SSL, non-pubcookie access. Used to access APIs with Basic Auth. <VirtualHost *:8443> SSLEngine on SSLOptions +StrictRequire SSLCertificateFile /etc/ssl/certs/server.cer SSLCertificateKeyFile /etc/ssl/private/server.key SSLProtocol +SSLv3 +TLSv1 SSLCipherSuite DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA:AES128-SHA:EDH-RSA-DES-CBC3-SHA:EDH-DSS-DES-CBC3-SHA:DES-CBC3-SHA ProxyRequests On ProxyPreserveHost On ProxyVia On ProxyPass /jira http://localhost:8080/jira ProxyPassReverse /jira http://localhost:8080/jira <Proxy *> Order deny,allow Allow from all </Proxy> RewriteEngine on RewriteLog "/var/log/apache2/rewrite.log" RewriteLogLevel 2 # Disable TRACE/TRACK requests, per security. RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) RewriteRule .* - [F] DocumentRoot /var/www DirectoryIndex index.html <Directory /var/www> Options FollowSymLinks AllowOverride None Order deny,allow Allow from all </Directory> </VirtualHost> <VirtualHost jira.company.com:80> ServerName jira.company.com RedirectMatch 301 /(.*)$ https://jira.company.com/$1 RewriteEngine on RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) RewriteRule .* - [F] </VirtualHost> <VirtualHost *:80> ServerName go.company.com RedirectMatch 301 /(.*)$ https://jira.company.com/$1 RewriteEngine on RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) RewriteRule .* - [F] </VirtualHost>

    Read the article

  • Mod_Rewrite w Apache mod_jrun22.so & ColdFusion 9 on cPanel

    - by Eddie B
    How can I utilize mod_rewrite at either the httpd.conf level or per-directory level when mod_jrun22 seems to have short-stopped the rewrite process for ColdFusion pages? I have a ColdFusion 9 based site running on Centos 5.8 w cPanel. cPanel uses EasyApache 3 to manage virtual host containers and as such the conf for mod_jrun22.so, /usr/local/apache/conf/includes/pre_main_global.conf, is loaded prior to the main httpd.conf with the domain specific rules for the container. My assertion is that .cfm pages are failing to be rewritten due to the mod_jk22.so module having priority in the directive chain. To note, I also have a WordPress blog in the site where the rewrites appear to be working fine. For example the following code to remove the index file works fine for php and fails with cfm ... .htaccess under /blog/ : This works Options -Indexes -Multiviews <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /blog/index.php [L] </IfModule> .htaccess under / : This does not work as expected. Apache serves the page. ASSERT: This would redirect to domain.com/ without index.cfm Options -Indexes -Multiviews <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.cfm$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.cfm [L] </IfModule> .htaccess under / : This works I'm presuming this is working because the redirect is to another .cfm page and a 404 handler in Application.cfc ... Options -Indexes -Multiviews <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^.*\.cfm$ - [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{ENV:REDIRECT_STATUS} =404 RewriteRule . /404.cfm$ [L] </IfModule> I've attempted numerous different methods to rewrite .cfm urls ... Adding [PT], [L], [R], [NS], Moving the script to Directory blocks under httpd.conf --- all with the same results ... either the rewrite doesn't work or Apache crashes in an endless loop ... Any help would be greatly appreciated. Below is a single-visit rewrite log snippet for a request to /index.cfm ... the pass-through is taking effect before the rewrite ... cat rewrite_dump_mod | grep index.cfm [perdir /home/foo/public_html/] strip per-dir prefix: /home/foo/public_html/index.cfm -> index.cfm [perdir /home/foo/public_html/] applying pattern '^.*\.cfm$' to uri 'index.cfm' [perdir /home/foo/public_html/] pass through /home/foo/public_html/index.cfm [perdir /home/foo/public_html/] strip per-dir prefix: /home/foo/public_html/index.cfm -> index.cfm [perdir /home/foo/public_html/] applying pattern '^.*\.cfm$' to uri 'index.cfm' [perdir /home/foo/public_html/] pass through /home/foo/public_html/index.cfm * UPDATE * I've managed to figure this out ... it took a while ... Options -Indexes -Multiviews +FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^.*/index\.cfm RewriteRule ^(.*)index.cfm http://%{HTTP_HOST}/$1 [R=301,L] </IfModule>

    Read the article

  • one page has more than one url. search engines give penalty please help me out.

    - by Ali Demirtas
    Hi I am using prestashop as the cart for my website. I have a problem; the website used to be in dynamic urls. I enabled friendly url writing. The problem is that one page has more than one url. You can access a same page from the dynamic url and static url. In fact a single page has 9 different urls. This obviously creates problems for seo as search engiones penalize my website for this. What can I do to solve this problem? I have no knowledge of programming. Here is the htaccess for the website. Any sample code or help is really appreciated. URL rewriting module activation RewriteEngine on URL rewriting rules RewriteRule ^([a-z0-9]+)-([a-z0-9]+)(-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*).jpg$ /img/p/$1-$2$3.jpg [L,E] RewriteRule ^([0-9]+)-([0-9]+)/([_a-zA-Z0-9-]*).jpg$ /img/p/$1-$2.jpg [L,E] RewriteRule ^([0-9]+)(-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]).jpg$ /img/c/$1$2.jpg [L,E] RewriteRule ^lang-([a-z]{2})/([a-zA-Z0-9-])/([0-9]+)-([a-zA-Z0-9-]).html(.)$ /product.php?id_product=$3&isolang=$1$5 [L,E] RewriteRule ^lang-([a-z]{2})/([0-9]+)-([a-zA-Z0-9-]).html(.)$ /product.php?id_product=$2&isolang=$1$4 [L,E] RewriteRule ^lang-([a-z]{2})/([0-9]+)-([a-zA-Z0-9-])(.)$ /category.php?id_category=$2&isolang=$1 [QSA,L,E] RewriteRule ^([a-zA-Z0-9-])/([0-9]+)-([a-zA-Z0-9-]).html(.*)$ /product.php?id_product=$2$4 [L,E] RewriteRule ^([0-9]+)-([a-zA-Z0-9-]).html(.)$ /product.php?id_product=$1$3 [L,E] RewriteRule ^([0-9]+)-([a-zA-Z0-9-])(.)$ /category.php?id_category=$1 [QSA,L,E] RewriteRule ^content/([0-9]+)-([a-zA-Z0-9-])(.)$ /cms.php?id_cms=$1 [QSA,L,E] RewriteRule ^([0-9]+)__([a-zA-Z0-9-])(.)$ /supplier.php?id_supplier=$1$3 [QSA,L,E] RewriteRule ^([0-9]+)_([a-zA-Z0-9-])(.)$ /manufacturer.php?id_manufacturer=$1$3 [QSA,L,E] RewriteRule ^lang-([a-z]{2})/(.*)$ /$2?isolang=$1 [QSA,L,E] Catch 404 errors ErrorDocument 404 /404.php Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^.com [NC] RewriteRule ^(.)$ http://www.*.com/$1 [L,R=301] Options +FollowSymLinks RewriteEngine on index.php to / RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.index.php\ HTTP/ RewriteRule ^(.)index.php$ /$1 [R=301,L] Header set Cache-Control: "no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0"

    Read the article

  • Codeigniter .htaccess not working in subdirectory

    - by xzdead
    I have this codeingniter project structure webRoot | |/application | | | |/controllers | | | |/admin | |/public | | | |/admin | | | | | |/css | | |/img | |/css | |/img And this is my .htacess file, located in /public. I use this in every local project running xampp: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> <IfModule !mod_rewrite.c> # If we don't have mod_rewrite installed, all 404's # can be sent to index.php, and everything works as normal. # Submitted by: ElliotHaughin ErrorDocument 404 /index.php </IfModule> It works fine in localhost, but doesn't work in a dreamhost server. I always get "no input file specified". So after searching the web and trying lots of combinations, the best I got is this .htaccess file: Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] With this one, if I go to http://development.mydomain.com - I see the codeigniter welcome page But if I go to: http://development.mydomain.com/admin - I see the directory listing of /public/admin and doesn't execute the controller in /application/controllers/admin Again, if I go to: http://development.mydomain.com/admin/admin - I see the private area, it executes the controller and goes to the default controller defined in routes, "dashboard" This works fine too: http://development.mydomain.com/admin/dashboard I have set in my config file: $config['index_page'] = ''; $config['base_url'] = ''; $config['uri_protocol'] = 'AUTO'; I think that whatever is wrong in my .htaccess is causing other path issues I have with my project. Any help would be great. Thanks to all in advance EDIT: I removed this line: RewriteCond %{REQUEST_FILENAME} !-d because admin directory exists, that's why I see the public directory listing. But now I see the codeigniter welcome page when I go to http://development.mydomain.com/admin So now my .htaccess file looks like: Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] #RewriteRule ^(.*)$ /index.php?/$1 [L] I also tried with the commented RewriteRule but I get the same result.

    Read the article

  • DNS and mod_rewrite not-collaborating

    - by ???? ?????????
    Hello, I have added a CNAME record to my DNS on my CentOS server to redirect subdomain.mydomain.com to another server. I also use mod_rewrite to rewrite mydomain.com to www.mydomain.com: RewriteEngine on RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC] RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301] this is placed into .htaccess in the root public html directory Now, the problem is that whenever I lookup subdomain.mydomain.com it redirects me to www.mydomain.com I tried adding another RewriteCond: RewriteEngine on RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC] RewriteCond %{HTTP_HOST} !^subdomain\.mydomain\.com$ [NC] RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301] But it didn't help... Anyone has some ideas?

    Read the article

  • passing URL vars to a wordpress page and pretty-fying it with .htaccess

    - by Jonah
    I have wordpress installed in a directory called welcome, and /welcome/samples is a "page" (created via Wordpress). It's has a php template waiting for a $_REQUEST['category'] When a user goes to /welcome/samples/fun, I want to have "fun" passed to the samples php template in the form welcome/samples/?category=fun But I want the URL to remain in its original form - it's currently replacing the it with the ugly "?cat...etc" # Outside the wordpress block so it won't be overwritten Options +FollowSymlinks RewriteEngine On RewriteRule ^samples/([^/]+)$ /welcome/samples?cat=$1 [R,L] # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /welcome/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /welcome/index.php [L] </IfModule> # END WordPress I tried Rewriting with simply samples?cat=$1 but I was getting a 404. I tried putting in the RewriteBase /welcome/ in the first block. without the [R] flag it doesn't work at all. I keep trying different permutations... and failing:( Perhaps I'm missing some basic concepts... thanks if you take the time to even read through this:) ciao

    Read the article

  • .htaccess redirect for www in parent folder and children react

    - by ServerChecker
    We were having a problem with the Norton seal not showing up on our affiliate marketing landing pages (landers). Turns out, the Norton seal was super picky about the "www." prefix. I had folder paths like /lp/cmpx where x was a number 1-100 and indicated advertising campaign number. So, to remedy this, I stuck this in my .htaccess file right after the RewriteEngine On line: RewriteCond %{HTTP_HOST} ^example\.com RewriteRule ^(.*)$ http://www.example.com/lp/cmp1/$1 [R=302,QSA,NC,L] Trouble is, I had to do that under every campaign folder, changing cmp1 to whatever the folder name was. Therefore, my question is... Is there a way I can do this with an .htaccess file under the parent folder (/lp in this case) and it will work for each of the children? EDIT: Note that I stuck an .htaccess file in /lp just now to test: RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com RewriteRule ^(.*)$ http://www.example.com/lp/$1 [R=302,QSA,NC,L] This yielded no effect to the /lp/cmpx folders underneath, to my dismay.

    Read the article

  • Wildcard subdomain to file htaccess

    - by Mikkel Larson
    I've have a problem with a htaccess wildcard redirect My base configuration is set to work with: www.domain.com and domain.com this is governed by 2 .htaccess files: 1: /home/DOMAIN/public_html/.htaccess AddDefaultCharset utf-8 RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?festen.dk$ RewriteCond %{REQUEST_URI} !^/public/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /public/$1 RewriteCond %{HTTP_HOST} ^(www.)?festen.dk$ RewriteRule ^(/)?$ public/index.php [L] 2: /home/DOMAIN/public_html/public/.htaccess AddDefaultCharset utf-8 <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On </IfModule> <IfModule mod_rewrite.c> RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> Now i want to redirect: www.[SUBDOMAIN].domain.com/[PATH] and [SUBDOMAIN].domain.com/[PATH] to public/index.php/subdomaincontroller/realsubdomain/[PATH] My solution so far: Added following to 2: /home/DOMAIN/public_html/public/.htaccess <IfModule mod_rewrite.c> RewriteCond %{HTTP_HOST} !www.domain.com$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+)domain.com [NC] RewriteRule (.*) subdomaincontroller/realsubdomain/%2/$1 [L] </IfModule> Sadly this dows not work. Can anyone help me please?

    Read the article

  • FreeBSD Server .htaccess issues

    - by Will Ayers
    Server Details: FreeBSD PHP Version 4.3.11 Apache Appache Modules: mod_throttle, mod_php4, mod_speedycgi, mod_ssl, mod_setenvif, mod_so, mod_unique_id, mod_headers, mod_expires, mod_auth_db, mod_auth_anon, mod_auth, mod_access, mod_rewrite, mod_alias, mod_actions, mod_cgi, mod_dir, mod_autoindex, mod_include, mod_info, mod_status, mod_negotiation, mod_mime, mod_mime_magic, mod_log_config, mod_define, mod_env, mod_vhost_alias, mod_mmap_static, http_core The issue I am having is when ever I write any kind of code in the .htaccess file, it throws a 500 Internal error I am simply trying to rewrite url's and am using the exact code that wordpress creates for me and even tried custom code used before on previous servers and it still does not work. WordPress created code: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /lobster-tail-blog/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /lobster-tail-blog/index.php [L] </IfModule> # END WordPress And even a simple thing like this throws the error: <IfModule mod_rewrite.c> RewriteEngine On </IfModule> Anyone know of any fixes or why this is causing this error? I have the mod_rewrite module loaded

    Read the article

  • Return http status ok (200) on request method OPTIONS Apache

    - by jazz
    I have a apache server which uses Reverse Proxy to connect/direct to a tomcat server. Using virtualHost, RequestHeader set X-Forwarded-Proto "http" ServerName image.abc.local DocumentRoot "/var/www/html" ProxyRequests Off ProxyTimeout 600 ProxyPass /abc http://image.abc.local:9001/abc ProxyPass /xyz http://image.abc.local:9001/xyz ProxyPassReverse /abc http://image.abc.local:9001/abc ProxyPassReverse /xyz http://image.abc.local:9001/xyz what i want to achieve here is that, when there is a REQUEST_METHOD OPTIONS i want simply return HTTP status OK (200). I dont want the request to be received by the tomcat server and process it. For performance based concerns i want this request to be handled at apache level. with all the research i was still unable to get this to run; RewriteEngine on RewriteCond %{REQUEST_METHOD} OPTIONS RewriteRule .* - [R=200m] can somebody assist me with what rewrite rule should be there? or is there an alternative to RewriteEngine? Thanks

    Read the article

  • mod_rewrite RewriteRule is not working

    - by buggy1985
    Hi, This is a follow-up of this question: Rewrite URL - how to get the hostname and the path? And a copy of this: mod_rewrite RewriteRule is not working I got this Rewrite Rule: RewriteEngine On RewriteRule ^(http://[-A-Za-z0-9+&@#/%=~_|!:,.;]*)/([-A-Za-z0-9+&@#/%=~_|!:,.;]*)\?([A-Za-z0-9+&@#/%=~_|!:,.;]*)$ http://http://www.xmldomain.com/bla/$2?$3&rtype=xslt&xsl=$1/$2.xsl it seems to be correct, and exactly what I need. But it doesn't work on my server. I get a 404 page not found error. mod_rewrite is enabled, as the following simple rule is working fine: RewriteEngine On RewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L] Can you help? Thanks

    Read the article

  • Apache rewrite rule to remove index.php and direct certain areas to https

    - by Stephen Martin
    I have a codeignitor application running on Apache2, I have managed to remove the index.php from the urls with this .htaccess RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php/$0 [PT,L] now I want to make certain parts of the site redirect to https, I tried this: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php/$0 [PT,L] RewriteRule ^/?cpanel/(.*) https://%{SERVER_NAME}/cpanel/$1 [R,L] RewriteRule ^/?login/(.*) https://%{SERVER_NAME}/cpanel/$1 [R,L] But it doesn't work. I have to say when it comes to Apache rewrites im a noob. I can't find any tutorials on how to remove index.php and rewrite/redirect certain parts of the site to https. Any ideas, Thanks.

    Read the article

  • Redirecting traffic to a https site

    - by Saif
    In our mail server there are multiple virtual email domain hosted. User can use webmail.example.com (this is the first apache virtualhost) to check mail or they can use mail.THEIR-DOMAIN.com. If the put mail.THEIR-DOMAIN.com apache shows the webmail.example.com as it is the first virtualhost and mail.THEIR-DOMAIN.com doesn't exist. Recently we imposed https for webmail.example.com and added this mod_rewrite rule: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} But now users not getting the default webmail page as they were getting before. How can we redirect all request coming to the URL "mail.ANY-DOMAIN.com" to "https://webmail.example.com"? I've tried the following but it didn't work: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (mail.*) https://webmail.example.com Thanks for your help in advance.

    Read the article

  • http 301 redirection issue

    - by Guilhem Soulas
    I'm a little bit lost with a redirection. I want mysite.com, www.mysite.com and www.mysite.co.uk to redirect to mysite.co.uk. In Apache, I wrote this for mysite.co.uk in order to redirect www to the root domain: RewriteEngine on RewriteCond %{HTTP_HOST} ^www RewriteRule ^/(.*) http://mysite.co.uk/$1 [L,R=301] And for mysite.com, I wrote this redirect to mysite.co.uk: ServerName www.mysite.com RewriteEngine on RewriteRule ^/(.*) http://mysite.co.uk/$1 [L,R=301] This way, I can make the redirection work properly from www.mysite.com to mysite.co.uk, but it doesn't work for mysite.com too mysite.co.uk (without the www) at the same time. Could someone tell me how to make all my redirections work in all cases?

    Read the article

  • Apache RewriteRule ignoring RewriteCond?

    - by winsmith
    So I have an Apache running on OSX Server 10.4 (don't ask) with multiple sites. In 0002_[example.com].conf, I have this bit of code: <Directory "/Library/WebServer/Documents/secret/"> RewriteEngine On RewriteCond %{REMOTE_ADDR} !^137\.250\. RewriteRule .* /messages/secret.html </Directory> However, in this configuration, the RewriteCond always seems to evaluate to false, since the secret directory gets shown even if the client's address does not begin with 137.250. If I change the config to this <Directory "/Library/WebServer/Documents/secret/"> RewriteEngine On RewriteRule .* /messages/secret.html RewriteCond %{REMOTE_ADDR} !^137\.250\. </Directory> the condition either does not get evaluated at all or always evaluates to true. Either way, all clients get blocked. What am I doing wrong?

    Read the article

  • How to specify Multiple Secure Webpages with .htaccess RewriteCond

    - by Patrick Ndille
    I have 3 pages that I want to make secure on my website using .htaccess -login.php -checkout.php -account.php I know how to make just one work page at a time using .htaccess RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} /login.php RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L] I and trying to figure out how to include the other 2 specific pages to make them also secure and used the expression below but it didn't work RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} /login.php RewriteCond %{REQUEST_URI} /checkout.php RewriteCond %{REQUEST_URI} /account.php RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L] Can someone help me the right expression that will work with multiple pages? The second part of the code is that, if https is already on and a user move to a page that Is not any of the pages i specified about, I want that it should get back to http. how should I write the statement for it to redirect back to http if its not any of the pages above? I have my statement like this but its not working RewriteCond %{HTTPS} on RewriteRule !(checkout|login|account|payment)\.php http://%{HTTP_HOST}%{REQUEST_URI} [L,R] Any thoughts?

    Read the article

  • Please Help Me Optimize This

    - by Zero
    I'm trying to optimize my .htaccess file to avoid performance issues. In my .htaccess file I have something that looks like this: RewriteEngine on RewriteCond %{HTTP_USER_AGENT} bigbadbot [NC,OR] RewriteCond %{HTTP_USER_AGENT} otherbot1 [NC,OR] RewriteCond %{HTTP_USER_AGENT} otherbot2 [NC] RewriteRule ^.* - [F,L] The first rewrite rule (bigbadbot) handles about 100 requests per second, whereas the other two rewrite rules below it only handle a few requests per hour. My question is, since the first rewrite rule (bigbadbot) handles about 99% of the traffic would it be better to place these rules into two separate rulesets? For example: RewriteEngine on RewriteCond %{HTTP_USER_AGENT} bigbadbot [NC] RewriteRule ^.* - [F,L] RewriteCond %{HTTP_USER_AGENT} otherbot1 [NC,OR] RewriteCond %{HTTP_USER_AGENT} otherbot2 [NC] RewriteRule ^.* - [F,L] Can someone tell me what would be better in terms of performance? Has anyone ever benchmarked this? Thanks!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >