Need to manipulate my url - php

I'm literally just starting to throw a site together today, so I don't even have much to work with yet, but I wanted to throw this out there so I'll have the information when I get there. I'm using WAMP (not sure which version, but downloaded within the last 6 months) and CodeIgniter 2.0.3. How do you manipulate the URL to do the following:
www.mysite.com/forums ==> forums.mysite.com
www.mysite.com/pc ==> pc.mysite.com
...
Would this be something that gets done with the htaccess file or some other way? And if it is the htaccess file, can someone provide specifics? I've looked into some sites that try to explain the htaccess file and they just confuse the crap out of me. :) lol. Oh yeah, and how will that look while looking at it on my local host? Currently my url looks like:
localhost/nothingbutcards/
Thank you all very much, hope you're enjoying your weekend.

Along with the reference material provided, the below should be a good starting point. It's an HTACCESS approach.
http://terriswallow.com/weblog/2008/htaccess-redirect-a-directory-to-a-subdomain-and-force-www/
I also wanted to mention, some web hosts now have this as an option in the configuration panel. Mine does, so I can go in, specify a subdomain and the path on the site it points to, and I'm done.

Related

How to create an index-file for Xampp

I apologize in advance if this issue has been posted before. My problem is that my programmer had to bail on my project due to personal reasons and left me alone with a 95% finished site. I have some basic experience with ASP classic but PHP is fairly new to me.
FireFTP scr_shot: https://www.dropbox.com/s/9lws1u0sl8k93rg/fireftp_scr_shot.jpg
To shorten it up; (with Xampp installed) I have downloaded my site to the hard-drive and is now trying to get it work on 'localhost'. Immediately I sense the absence of an index-file.
Do I need to make one myself for the use in localhost? In that case, what am I looking for?
Thank you in advance.
First if you want to make an index-file of your current website, you have to put all your pages in a folder in
xampp/htdocs/
e.g
C:\Xampp\htdocs\mywebsite
then after you make a directory just visit the url like this:
localhost/mywebsite
, remember to put an index file inside the mywebsite folder.
It turned out that there was a MYSQL-database behind the site which I had no idea about or any knowledge of how to get around.
I had the database taken off and written the code into the site-files.
Afterwards everything worked as laid out above comments.

Recess framework: Why am I getting a resource not found error when the file exists?

I'm thinking of using the Recess Framework which I downloaded as-is and followed the instructions studiously.
I'm using it with PHP (which is not the issue) and I seem to have it up and running... however I suspected something was slightly wrong with the pages being served (they did not contain the expected logos) so I inspected the code only to find out that the frameworks javascript and CSS files were "resource not found".
Incidentally the files exist at the path specified, and it's not a question that permissions are not set correctly - I checked that too.
But... I'm new to using "routing" through URLs as part of a MVC style and wondered if basically it has something to do with that.
If you download the framework, you'll find that the css and javascript files that make things look pretty, and activate certain parts of the framework toolset exists at the path:
http://localhost/yourRecessFolderName/index.php/recess/recess/apps/tools/public/js/shCore.js
but I get the dreaded 404 resource not found and this is preventing recess tools from working properly.
1) Has any body else had this or a similar problem?
2) What are the likely causes - help by pointing me in the right direction, unless you know the answer of course
On Recess v0.2, there is an .htaccess file in /apps that prevents direct access to children. You'd need to modify the .htaccess or configure something custom in mod_rewrite to allow the public folders under apps to be seen.
Well, seemed to fix it by downloading the most recent ("latest edge") version of the Recess framework from https://github.com/recess/recess
Everything seems to work fine now... hmm 0.o
When pass from Development to Production, the Recess Framework use a Cache for accelerate access to site. Is possible, in your case, that the cache content is wrong.
I suggest you access path /your/recess/path/data/temp and remove the files recess.php and sqlite-cache.db and try again.
I hope this help you.

How do I ensure Symfony url_for() includes the PHP filename?

I've been battling to set up my Symfony project on a IIS web server, but have got it pretty much working.
I still can't get the nice URLs working though. When I use my dev environment, url_for generates URLs that look like .../frontend_dev.php/booking/create and everything works fine. But as soon as I use the prod environment url_for generates URLs that look like .../booking/create, which don't work presumably because of problems with the rewrite setup on IIS.
I don't want to try and get the proper rewrite working on IIS - I've stuffed around with that for ages now and have given up. If you have a silver bullet to fix my problem then I'd love to know but that's not really what the question is about.
I've found that calling .../index.php/booking/create works fine. Therefore I can fix my problem simply by ensuring that url_for always adds the filename. But how can I do this? I thought it might be just assuming index.php, so I made a copy called frontend.php but it still generates nice URLs, without the filename. It seems that if it's the dev environment, it adds the file, but if it's the prod environment, it hides it. Any ideas on how to override this?
In apps/appname/config/settings.yml, set no_script_name to false.
See the symfony Reference Book.

Address of yii applications

I a new in Ubuntu and PHP frameworks. I had read the book about Yii name "Agile web application development with yii and php 5".
And this is the part of text:
Yii comes with a simple requirement checking tool. To invoke
the tool and have it verify the requirements for your installation, simply point
your browser to:
http://yourhostname/path/to/yii/requirements/index.php
I installed yii in /var/www/html/yii directory.
When I trying to open http://localhost/var/www/html/yii/requirements/index.php I get error message: Oops! This link appears to be broken.
Thanks for any help!
It depends on what your Apache server's "webroot" (localhost) is.
If your webroot is /var/www/html then el chief's answer would work:
http://localhost/yii/requirements/index.php
But your webroot is /var/www then you need to include the html part too:
http://localhost/html/yii/requirements/index.php
Basically "localhost" = /some/path (your Apache webroot), and when you are writing your URL you can just substitute the two.
So if "localhost" = /var/www instead of writing http://var/www/index.php you just write http://localhost/index.php
I hope this helps you with a higher-level understanding of what is going on.
This might help somebody, even though the question is already answered, since I had come searching here, even though the underlying issue was different.
I made the dumb mistake of extracting the downloaded yii archive into the www directory and accessing it via the http://localhost/yii/ URL, but took a while to realise that the extracted directory has the build#-release#, and once renamed to just "yii", things worked. Like I said, the problem you faced was different, but symptom was somewhat similar.
it should be http://localhost/yii/requirements/index.php
Also be aware that this book, while helpful, seems to have been rushed to publication. There's many fixes to be found on the Yii forums. I suggest you keep a tab open whenever you come across something that doesn't work or doesn't seem "right" in the book.

Rewrite index.php in Wordpress

I started a blog and when I changed my permalink structure to /%postname%/ I get a Page Not Found error. I want my url to look like this:
http://bobbybeckner.com/sharepoint-list-and-linq-using-jquery-and-ihttphandler/
not this:
http://bobbybeckner.com/index.php/sharepoint-list-and-linq-using-jquery-and-ihttphandler/
I read a few posts about changing .htaccess but found no clear solution. Any code examples welcome or recommendations on wordpress plug-ins would be greatly appreciated.
Update
I thought it would be important to mention that my host is running IIS7 but does not allow users to touch it. In addition, I'm uncertain of any restrictions on the .htaccess file or any other configuration limitations.
.htaccess files only apply to Apache (well, maybe some other servers use it too, but not IIS). AFAIK URL rewriting for IIS is possible, but not as easy.
ISAPIRewrite appears to be a commercial application that does this, but of course, you'd need to get it installed on your server.
Personally, I wouldn't lose any sleep over having /index.php/ in your urls.
Generally when you fill out the structure, if the .htaccess file is writable it will apply the rewrite for you, and if it isn't it will show what the contents should be at the very bottom of the page. Did you check the bottom of the page if it is not writable?
You do NOT have to code this yourself.

Categories