On my website I have a catalog page: http://website.com/beads and pagination links at the bottom of the page
Pagination links on my local server looks like http://website.com/beads/page2, http://website.com/beads/page3, etc.
On hosting it looks like http://website.com/beads/page2?/beads=, http://website.com/beads/page3?/beads= etc its bad even without additional filters(with it its getting horrible)
If I do on catalog page debug::vars($this->request->query());
On a local server it prints: array(0)
On a hosting: array(1) ( "/beads" => string(0) "" )
Hosting runs FastCGI, my route looks like:
Route::set('catalog', '<uri>(/page<page>)',
array(
'uri' => '[a-z0-9-]+',
'page' => '[0-9]+')
)
->defaults(array(
'directory' => 'frontend',
'controller' => 'catalog',
'action' => 'index'
)
);
.htaccess on local server and hosting is the same expept this:
Hosting: RewriteRule .* index.php?/$0 [PT,L,QSA]
Local: RewriteRule .* index.php/$0 [PT]
Where could be the problem?
Related
I need to change the link at wordpress admin bar. I want the Link of Database (ie. /wp-admin/) to /wp-admin/index.php
What I try:
I try changing the link [admin_url() to admin_url('index.php') at /wp-includes/admin-bar.php
.
.
// We're on the front end, link to the Dashboard.
$wp_admin_bar->add_menu( array(
'parent' => 'site-name',
'id' => 'dashboard',
'title' => __( 'Dashboard' ),
'href' => admin_url('index.php'), // 'href' => admin_url(),
) );
.
.
This did not work. How could I do it?
I need to go to /wp-admin/index.php as it says redirect loops on /wp-admin/
Maybe you should rather fix your redirect loop problem before is escalates? I've often seen that happen when FORCE_SSL_ADMIN was on but the Site didn't understand it was being requested via SSL ($_SERVER["HTTPS"] doesn't exist or isn't "on").
However, you could also circumvent that redirect loop by adding
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/$ /wp-admin/index.php [R=302,L]
in your .htaccess before the WP-rules.
CakePHP version-2.5.5
My domain name is http://www.thechatfun.com
Profile page link - http://www.thechatfun.com/users/profile
Chat page link - http://www.thechatfun.com/chats/index
Above two link i want to looks like http://profile.thechatfun.com and http://www.chat.thechatfun.com
I am unable to make subdomain in the CakePHP.
Please help me
Thanks
ChatFun
As long as you can configure your domain records to point both chat and profile subdomains to your server then you can change the htaccess file in your webroot folder and add..
<IfModule mod_rewrite.c>
#standard cake htaccess stuff
...
RewriteCond %{HTTP_HOST} ^profile\.thechatfun\.com$ [NC]
RewriteRule ^(.*)$ http://www.thechatfun.com/users/profile/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^chat\.thechatfun\.com$ [NC]
RewriteRule ^(.*)$ http://www.thechatfun.com/chats/index/$1 [R=301,L]
</IfModule>
I have this exact requirement and this works for me.
Follow your context, inside this directory: /lib/Cake/Routing/Route , create file SubdomainRoute.php with content:
class SubdomainRoute extends CakeRoute {
public function match($params) {
$subdomain = isset($params['subdomain']) ? $params['subdomain'] : null;
unset($params['subdomain']);
$path = parent::match($params);
if ($subdomain) {
$path = 'http://' . $subdomain . '.thechatfun.com' . $path;
}
return $path;
}
}
When creating links you could do the following to make links pointing at other subdomains.
echo $this->Html->link(
'Profile',
array('subdomain' => 'profile', 'controller' => 'Users', 'action' => 'profile')
);
echo $this->Html->link(
'Chats',
array('subdomain' => 'chat', 'controller' => 'Chats', 'action' => 'index')
);
Reference: http://book.cakephp.org/2.0/en/appendices/new-features-in-cakephp-2-0.html#routes-can-return-full-urls
profile.thechatfun.com and www.chat.thechatfun.com are different domains. It's possible for a single http server to handle both of these domains, but it won't happen automatically.
Assuming your webserver is Apache, you will first need to configure the webserver to handle these domains correctly. You can add a VirtualHost directive so that both of these domains are handled by the same Virtual Host and share a document root, or you can add a Virtual Host for each and have separate document root directories for each domain.
Your webserver first receives the HTTP request, then passes the request to PHP for processing. So, if your webserver isn't configured properly to handle these domains, you won't have the ability to control this in PHP or CakePHP.
I am creating a website which runs on https.. But when i create absolute url using
echo Yii::app()->createAbsoluteUrl('site/index');
it always return http://mydomainname.com/site/index.
my expected output is https://mydomainname.com/site/index.
How can i create a url with https ?
Try this
Yii::app()->createAbsoluteUrl('site/index', array(), 'https');
Edit .htaccess file in your project folder and add these lines.It will Redirect all http traffic to https.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://mydomainname.com/$1 [R,L]
Try to change host
'components' => array(
...
'request' => array(
'HostInfo' => 'https://mydomainname.com',
),
...
),
The "single shot" way is to set https:// in the baseUrl parameter from the configuration:
...
'components' => array(
...
'request' => array(
'baseUrl' => ' https://mydomainname.com/site',
),
...
),
You're best off creating a custom UrlManager implementation as described here:
http://www.yiiframework.com/wiki/407/url-management-for-websites-with-secure-and-nonsecure-pages
The benefit is that your users won't have to suffer through needless double redirects every time you have a genuine redirect.
i already shearch, and i never found this that i am asking, soo i want to know if it is even possible... or not ...
I am testing this in IPB.Board 3.4.5, with the app IP.Downloads.
I have this static url in my site that users can acess to download one file:
mysite.com/files/file/2-filename.txt
The original dynamic url is something like:
.../?app=downloads&showfile=2
The change of the url is made by that app (IP.Downloads)...
i want to change it to url:
mysite.com/text/2-filename.txt
so when the user insert in browser
1 mysite.com/text/2-filename.txt
they see the file
2 mysite.com/files/file/2-filename.txt
they are rewrite to mysite.com/text/2-filename.txt
and see the file.
How can i do that? change from ( /files/file/ ) to ( /text/ ) ...
that can be made by .htaccess or i have to change the app files? or is impossible?
::UPDATE::
I have done it! without .htaccess , i change the core files that rewrite the url...
see the Answer below ...
Thanks for any help.
Add this to your .htaccess in your web root / directory
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+files/file/([^?\s]+) [NC]
RewriteRule ^ /text/%1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+text/ [NC]
RewriteRule ^ /files/file/%1
I made it by changing the core files ... it is more simple for me, so i use this way.
thanks #ravi-thapliyal for trying to help making this by .htaccess, but i prefer this way ...
First open this file:
{forum-root}/admin/applications_addon/ips/downloads/extensions
Edit this code ['idmshowfile'] in the $_SEOTEMPLATES = array
This will tell the server that when the user go to (myserver.com/text/) they want to see the file...
'idmshowfile' => array(
'app' => 'downloads',
'allowRedirect' => 1,
'out' => array( '/app=downloads(&|&)showfile=(.+?)(&|$)/i', 'text/$2-#{__title__}/$3' ),
'in' => array(
'regex' => "#/text/(\d+?)-#i",
'matches' => array(
array( 'app' , 'downloads' ),
array( 'showfile' , '$1' ))
)
),
And add this code to $_SEOTEMPLATES = array, in any position ...
this will tell to server that if the user go to (myserver.com/files/file/) they will be rewrite the url (myserver.com/text/) , and see the file.
'idmshowfile2' => array(
'app' => 'downloads',
'allowRedirect' => 1,
'out' => array( '/app=downloads(&|&)showfile=(.+?)(&|$)/i', 'text/$2-#{__title__}/$3' ),
'in' => array(
'regex' => "#/files/file/(\d+?)-#i",
'matches' => array(
array( 'app' , 'downloads' ),
array( 'showfile' , '$1' ))
)
),
You can add as many rewrites as you want to the Forum, and create nice and friendly SEO URL.
Of course i know that this file can be overwrite in future updates of the app, soo i will make backup, and if possibel create an hook or app to make this (... if possibel).
I have the following couched in my .htaccess file:
Options -Indexes
RewriteEngine on
RewriteBase /properties/
RewriteRule ^view/([0-9]+)$ view.php?id=$1 [QSA]
I want to write a "pretty" URL like http://example.com/properties/view/1 to http://example.com/properties/view.php?id=1.
The RewriteRule is passing the request to my view.php script, but it doesn't seem to be doing the query string bit. For example, if I do print_r($_SERVER) I see the following:
Array
(
...
[DOCUMENT_ROOT] => /Users/Martin/Sites/[removed]/
...
[SCRIPT_FILENAME] => /Users/Martin/Sites/[removed]/properties/view.php
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /properties/view/1
[SCRIPT_NAME] => /properties/view.php
[PATH_INFO] => /1
[PATH_TRANSLATED] => /Users/Martin/Sites/[removed]/1
[PHP_SELF] => /properties/view.php/1
...
)
Why is QUERY_STRING empty? And why can't I access "1" with $_GET['id']?
Note: Obviously I've placed the [removed] tokens in the file paths.
It doesn't look to me like your rewrite rule is working. Otherwise I think the following values would be converted:
[REQUEST_URI] => /properties/view/1
[PHP_SELF] => /properties/view.php/1
If the rewrite rule were working, your php script would see the rewritten URI.
Some ideas...
What is your RewriteCond? Is that matching?
I have never tried matching the partial path without trying to at least use a .* to match from the beginning. What if you tried one of the following?
RewriteRule ^/?properties/view/([0-9]+)$ /properties/view.php?id=$1 [NC,L]
RewriteRule ^.*/view/([0-9]+)$ /properties/view.php?id=$1 [NC,L]
You are only rewriting urls that start with view using:
^view/([0-9]+)$
because the ^ means anchored to the start.
You could change it to for example:
^properties/view/([0-9]+)$